home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_148 / fme / source / fme.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  88KB  |  3,065 lines

  1. #include "stdio.h"
  2. #include "exec/types.h"
  3. #include "functions.h"
  4. #include "libraries/dosextens.h"
  5. #include "intuition/intuition.h"
  6. #include "graphics/gels.h"
  7.  
  8. double ran();
  9. struct Window *OpenWindow();
  10. struct ViewPort *ViewPortAddress();
  11. struct VSprite *MakeBob();
  12.  
  13. struct VSprite *MyBob;
  14. struct VSprite *Barracks;
  15. struct VSprite *Bigtree;
  16. struct VSprite *Blank;
  17. struct VSprite *Crsturret;
  18. struct VSprite *Door;
  19. struct VSprite *Drroad;
  20. struct VSprite *Drtur;
  21. struct VSprite *Flag;
  22. struct VSprite *Fuel;
  23. struct VSprite *Helipad;
  24. struct VSprite *Home;
  25. struct VSprite *Horroad;
  26. struct VSprite *Horwall;
  27. struct VSprite *Lrdroad;
  28. struct VSprite *Lruroad;
  29. struct VSprite *Medtree;
  30. struct VSprite *Medic;
  31. struct VSprite *Officer;
  32. struct VSprite *Prisoner;
  33. struct VSprite *Rdroad;
  34. struct VSprite *Rdtur;
  35. struct VSprite *Ruroad;
  36. struct VSprite *Rutur;
  37. struct VSprite *Rudroad;
  38. struct VSprite *Smtree;
  39. struct VSprite *Turret;
  40. struct VSprite *Udrroad;
  41. struct VSprite *Urroad;
  42. struct VSprite *Urtur;
  43. struct VSprite *Utility;
  44. struct VSprite *Verroad;
  45. struct VSprite *Verwall;
  46. struct IntuitionBase *IntuitionBase;
  47. struct GfxBase *GfxBase;
  48. struct DiskfontBase *DiskfontBase;
  49. struct Screen *CustScr;
  50. struct Window *Wdw;
  51. struct ViewPort *Vp;
  52. struct RastPort *Rp;
  53. struct TextFont *FontPtr1;
  54. struct TextFont *FontPtr2;
  55. struct IntuiMessage *message;
  56.  
  57. USHORT colors[] =
  58.   {
  59.     0x0666, 0x0000, 0x0340, 0x0530
  60.   };
  61.  
  62. struct TextAttr StdFont =
  63.   {
  64.     "df0:fonts/sg_Topaz.font",9,0,0
  65.   };
  66.  
  67. struct TextAttr SysFont =
  68.   {
  69.     "topaz.font",TOPAZ_EIGHTY,0,0
  70.   };
  71.  
  72. struct NewScreen NewCustScr =
  73.   {
  74.     0,0,640,400,2,0,1,HIRES|LACE,CUSTOMSCREEN,NULL,NULL,NULL,NULL
  75.   };
  76.  
  77. struct NewWindow NewWdw =
  78.    {
  79.     0,0,640,400,0,1,
  80.     CLOSEWINDOW|
  81.     MOUSEMOVE|
  82.     RAWKEY|
  83.     MOUSEBUTTONS|
  84.     MENUPICK,
  85.  
  86.     WINDOWCLOSE|
  87.     REPORTMOUSE|
  88.     ACTIVATE,
  89.     NULL,NULL,"FirePower Map Editor(c)V1.0    \\ /          by Greg MacKay   ",
  90.     NULL,NULL,0,0,0,0,CUSTOMSCREEN
  91.    };
  92.  
  93. #define FILE_MENU 0
  94.  
  95. int item_widths = 80;
  96.  
  97. #define BLACK_FILL  ITEMTEXT | ITEMENABLED | HIGHCOMP
  98.  
  99. #define NUM_FILE_ITEMS 8
  100. #define NEW_ITEM       0
  101. #define LOAD_ITEM      1
  102. #define SAVE_ITEM      2
  103. #define LOADLEFT_ITEM  3
  104. #define LOADRIGHT_ITEM 4
  105. #define SAVELEFT_ITEM  5
  106. #define SAVERIGHT_ITEM 6
  107. #define QUIT_ITEM      7
  108.  
  109. struct MenuItem  file_items[NUM_FILE_ITEMS];
  110. struct IntuiText file_names[NUM_FILE_ITEMS];
  111.  
  112. char  *filemenu_names[] =
  113. {
  114.    "New",
  115.    "Load",
  116.    "Save",
  117.    "Load Left",
  118.    "Load Right",
  119.    "Save Left",
  120.    "Save Right",
  121.    "Quit"
  122. };
  123.  
  124. struct Menu fmenu =
  125. {
  126.   NULL,
  127.   0, 0, 60, 10,
  128.   MENUENABLED,
  129.   "Options",
  130.   file_items
  131. };
  132.  
  133. WORD barracks[18] =
  134. {
  135.   0x0,0xFF80,0x9480,0x9480,0x9480,0x9480,0x9480,0xFF80,0x0,
  136.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  137. };
  138.  
  139. WORD bigtree [18] =
  140. {
  141.   0x0,0x1C00,0x3E00,0x7F00,0x7F00,0x7F00,0x3E00,0x1C00,0x0,
  142.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  143. };
  144.  
  145. WORD blank [18] =
  146. {
  147.   0xFF80,0x8080,0x8080,0x8080,0x8080,0x8080,0x8080,0x8080,0xFF80,
  148.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  149. };
  150.  
  151. WORD crsturret [18] =
  152. {
  153.   0x1400,0x1400,0x3E00,0xE380,0x2A00,0xE380,0x3E00,0x1400,0x1400,
  154.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  155. };
  156.  
  157. WORD door [18] =
  158. {
  159.   0x1400,0x1C00,0x800,0xEB80,0xEB80,0xEB80,0x800,0x1C00,0x1400,
  160.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  161. };
  162.  
  163. WORD drroad [18] =
  164. {
  165.   0x1C00,0x1C00,0x1C00,0x1F80,0x1F80,0x1F80,0x0,0x0,0x0,
  166.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  167. };
  168.  
  169. WORD drtur [18] =
  170. {
  171.   0x1400,0x1400,0x3E00,0x2380,0x2A00,0x2380,0x3E00,0x0,0x0,
  172.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  173. };
  174.  
  175. WORD flg[18] =
  176. {
  177.   0xFF80,0x8080,0xBC80,0xA080,0xB880,0xA080,0xA080,0x8080,0xFF80,
  178.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  179. };
  180.  
  181. WORD fuel [18] =
  182. {
  183.   0x3000,0x4800,0x8400,0x8400,0x4C00,0x3600,0x380,0x280,0x380,
  184.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  185. };
  186.  
  187. WORD helipad [18] =
  188. {
  189.   0x1C00,0x2200,0x4100,0x8080,0x8080,0x8080,0x4100,0x2200,0x1C00,
  190.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  191. };
  192.  
  193. WORD home [18] =
  194. {
  195.   0xFF80,0x8080,0xA280,0xA280,0xBE80,0xA280,0xA280,0x8080,0xFF80,
  196.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  197. };
  198.  
  199. WORD horroad [18] =
  200. {
  201.   0x0,0x0,0x0,0xFF80,0xFF80,0xFF80,0x0,0x0,0x0,
  202.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  203. };
  204.  
  205. WORD horwall [18] =
  206. {
  207.   0x0,0x0,0x0,0xFF80,0x0,0xFF80,0x0,0x0,0x0,
  208.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  209. };
  210.  
  211. WORD lrdroad [18] =
  212. {
  213.   0x0,0x0,0x0,0xFF80,0xFF80,0xFF80,0x1C00,0x1C00,0x1C00,
  214.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  215. };
  216.  
  217. WORD lruroad [18] =
  218. {
  219.   0x1C00,0x1C00,0x1C00,0xFF80,0xFF80,0xFF80,0x0,0x0,0x0,
  220.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  221. };
  222.  
  223. WORD medtree [18] =
  224. {
  225.   0x0,0x0,0x1800,0x3C00,0x3C00,0x1800,0x0,0x0,0x0,
  226.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  227. };
  228.  
  229. WORD medic [18] =
  230. {
  231.   0xFF80,0x8080,0xA280,0xB680,0xAA80,0xA280,0xA280,0x8080,0xFF80,
  232.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  233. };
  234.  
  235. WORD officer [18] =
  236. {
  237.   0xFF80,0x8080,0x9C80,0xA280,0xA280,0xA280,0x9C80,0x8080,0xFF80,
  238.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  239. };
  240.  
  241. WORD prisoner [18] =
  242. {
  243.   0xFF80,0x8080,0xBC80,0xA480,0xBC80,0xA080,0xA080,0x8080,0xFF80,
  244.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  245. };
  246.  
  247. WORD rdroad [18] =
  248. {
  249.   0x0,0x0,0x0,0xFC00,0xFC00,0xFC00,0x1C00,0x1C00,0x1C00,
  250.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  251. };
  252.  
  253. WORD rdtur [18] =
  254. {
  255.   0x0,0x0,0x3E00,0xE200,0x2A00,0xE200,0x3E00,0x1400,0x1400,
  256.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  257. };
  258.  
  259. WORD ruroad [18] =
  260. {
  261.   0x1C00,0x1C00,0x1C00,0xFC00,0xFC00,0xFC00,0x0,0x0,0x0,
  262.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  263. };
  264.  
  265. WORD rutur [18] =
  266. {
  267.   0x1400,0x1400,0x3E00,0xE200,0x2A00,0xE200,0x3E00,0x0,0x0,
  268.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  269. };
  270.  
  271. WORD rudroad [18] =
  272. {
  273.   0x1C00,0x1C00,0x1C00,0xFC00,0xFC00,0xFC00,0x1C00,0x1C00,0x1C00,
  274.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  275. };
  276.  
  277. WORD smtree [18] =
  278. {
  279.   0x0,0x0,0x0,0x800,0x1C00,0x800,0x0,0x0,0x0,
  280.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  281. };
  282.  
  283. WORD turret [18] =
  284. {
  285.   0x0,0x0,0x3E00,0x2200,0x2A00,0x2200,0x3E00,0x0,0x0,
  286.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  287. };
  288.  
  289. WORD udrroad [18] =
  290. {
  291.   0x1C00,0x1C00,0x1C00,0x1F80,0x1F80,0x1F80,0x1C00,0x1C00,0x1C00,
  292.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  293. };
  294.  
  295. WORD urroad [18] =
  296. {
  297.   0x0,0x0,0x0,0x1F80,0x1F80,0x1F80,0x1C00,0x1C00,0x1C00,
  298.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  299. };
  300.  
  301. WORD urtur [18] =
  302. {
  303.   0x0,0x0,0x3E00,0x2380,0x2A00,0x2380,0x3E00,0x1400,0x1400,
  304.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  305. };
  306.  
  307. WORD utility [18] =
  308. {
  309.   0xFF80,0x8080,0xA280,0xA280,0xA280,0xA280,0x9C80,0x8080,0xFF80,
  310.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  311. };
  312.  
  313. WORD verroad [18] =
  314. {
  315.   0x1C00,0x1C00,0x1C00,0x1C00,0x1C00,0x1C00,0x1C00,0x1C00,0x1C00,
  316.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  317. };
  318.  
  319. WORD verwall [18] =
  320. {
  321.   0x1400,0x1400,0x1400,0x1400,0x1400,0x1400,0x1400,0x1400,0x1400,
  322.   0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0
  323. };
  324.  
  325. int map[65][65];
  326. int topoffset, pen, roadpen;
  327. int ObjValue;
  328. char *ObjCode;
  329. LONG strlen();
  330. ULONG class;
  331. USHORT code;
  332. BYTE *OutText[6];
  333. BOOL MouseMoved;
  334. int x,y;
  335. double ran();
  336. int rndnum;
  337.  
  338. main()
  339. {
  340.  
  341.   IntuitionBase = (struct IntuitionBase *)
  342.        OpenLibrary("intuition.library",0);
  343.   if (IntuitionBase == NULL)
  344.     {
  345.        printf("Could not open Intuition Library\n");
  346.        exit(FALSE);
  347.     }
  348.  
  349.   GfxBase = (struct GfxBase *)
  350.        OpenLibrary("graphics.library",0);
  351.   if (GfxBase==NULL)
  352.     {
  353.        CloseLibrary(IntuitionBase);
  354.        printf("Could not open Graphics Library\n");
  355.        exit(FALSE);
  356.     }
  357.  
  358.   DiskfontBase = (struct DiskfontBase *)
  359.        OpenLibrary("diskfont.library",0);
  360.   if (DiskfontBase == NULL)
  361.     {
  362.        CloseLibrary(GfxBase);
  363.        CloseLibrary(IntuitionBase);
  364.        printf("Could not open Diskfont Library\n");
  365.        exit(FALSE);
  366.     }
  367.  
  368.   if ((NewWdw.Screen = CustScr = (struct Screen *)
  369.        OpenScreen(&NewCustScr)) == NULL)
  370.     {
  371.        CloseLibrary(IntuitionBase);
  372.        CloseLibrary(GfxBase);
  373.        CloseLibrary(DiskfontBase);
  374.        printf("Could not open Custom Screen\n");
  375.        exit(FALSE);
  376.     }
  377.  
  378.   if ((Wdw = (struct Window *) OpenWindow(&NewWdw)) == NULL)
  379.     {
  380.        CloseLibrary(IntuitionBase);
  381.        CloseLibrary(GfxBase);
  382.        CloseLibrary(DiskfontBase);
  383.        CloseScreen(CustScr);
  384.        printf("Could not open Custom Window\n");
  385.        exit(FALSE);
  386.     }
  387.  
  388.   if ((FontPtr1 = (struct TextFont *)OpenDiskFont(&StdFont)) == NULL)
  389.     {
  390.        CloseLibrary(IntuitionBase);
  391.        CloseLibrary(GfxBase);
  392.        CloseLibrary(DiskfontBase);
  393.        CloseScreen(CustScr);
  394.        CloseWindow(Wdw);
  395.        printf("Could not open FirePower Editor Font\n");
  396.        exit(FALSE);
  397.     }
  398.  
  399.   if ((FontPtr2 = (struct TextFont *)OpenFont(&SysFont)) == NULL)
  400.     {
  401.        CloseLibrary(IntuitionBase);
  402.        CloseLibrary(GfxBase);
  403.        CloseLibrary(DiskfontBase);
  404.        CloseScreen(CustScr);
  405.        CloseWindow(Wdw);
  406.        CloseFont(FontPtr1);
  407.        printf("Could not open FirePower Text Font\n");
  408.        exit(FALSE);
  409.     }
  410.  
  411.    Rp = Wdw->RPort;
  412.    Vp = ViewPortAddress(Wdw);
  413.    
  414.    MakeGelsInfo(Rp);
  415.  
  416.    MyBob = MakeBob(650,410,9,1,2,blank,0x03,0x00);
  417.    AddBob(MyBob->VSBob,Rp);
  418.    ObjCode = " ";
  419.    ObjValue = 0;
  420.  
  421.    SortGList(Rp);
  422.    DrawGList(Rp,Vp);
  423.    RethinkDisplay();
  424.  
  425.    Initialize();
  426.  
  427.    /* This is the main loop */
  428.  
  429.    FOREVER
  430.     {
  431.       SetFont(Rp,FontPtr2);                            /*   Update    */
  432.       sprintf(OutText,"%3d,%2d",x/9,y/9-1+topoffset);  /*    map      */
  433.       PrintAt(582,394,OutText);                        /* coordinates */
  434.       SetFont(Rp,FontPtr1);
  435.  
  436.       MouseMoved = FALSE;
  437.       while(message = GetMsg(Wdw->UserPort))
  438.         {
  439.  
  440.           switch (message->Class)
  441.                 {
  442.                    case MOUSEMOVE   : MouseMoved = TRUE;
  443.                                       x = message->MouseX; /* Update true */
  444.                                       y = message->MouseY; /*   X and Y   */
  445.                                       ReplyMsg(message);   /* coordinates */
  446.                                       break;
  447.  
  448.                    case RAWKEY      : if ((message->Code) == 76)
  449.                                            ScrollUp();
  450.                                       if ((message->Code) == 77)
  451.                                            ScrollDn();
  452.                                       ReplyMsg(message);
  453.                                       break;
  454.  
  455.                    case MOUSEBUTTONS: if ((message->Code) == SELECTDOWN)
  456.                                         {
  457.                                            if (x < 583)
  458.                                               PlaceObj(); /*Clicked on map*/
  459.                                            if (x > 583)
  460.                                               ObjSelect(); /* or menu */
  461.                                         } 
  462.                                       ReplyMsg(message);
  463.                                       break;
  464.  
  465.                    case MENUPICK    : if (MENUNUM(message->Code) != MENUNULL)
  466.                                          domenu(ITEMNUM(message->Code));
  467.                                       ReplyMsg(message);
  468.                                       break;
  469.  
  470.                    case CLOSEWINDOW : ReplyMsg(message);
  471.                                       End_program();
  472.                                       exit(0);
  473.                                       break;
  474.  
  475.                      } /* End switch */
  476.         } /*End while*/
  477.   if(MouseMoved = TRUE)
  478.     {
  479.       MyBob->X = x-9;
  480.       MyBob->Y = y-10;
  481.       SortGList(Rp);      /* Update Bob */
  482.       DrawGList(Rp,Vp);
  483.       RethinkDisplay();
  484.     }
  485.  
  486.   }   /*End FOREVER*/
  487. }   /* End of Main */
  488.  
  489. /*Functions start here */
  490.  
  491. UpdateBob()
  492. {
  493.    SortGList(Rp);
  494.    DrawGList(Rp,Vp);
  495.    RethinkDisplay();
  496. }
  497.  
  498. PrintAt(a,b,s)
  499. int a,b;
  500. char *s;
  501. {
  502.    Move(Rp,a,b);
  503.    Text(Rp,s,strlen(s));
  504. }
  505.  
  506. ScrollUp()        /* This routine will scroll the screen down 9 pixels */
  507. {                 /* and print a new line of data at top of map. */
  508.    int top;
  509.    char *TempCode;
  510.    if (topoffset > 0)
  511.      {
  512.          TempCode = ObjCode;
  513.          MyBob->X = 650;
  514.          MyBob->Y = 410;
  515.          UpdateBob();
  516.          ScrollRaster(Rp,0,-9,3,11,579,397);
  517.          topoffset -= 1;
  518.  
  519.          for (top=0;top<64;top++)
  520.             {
  521.                 if (map[top+1][topoffset+1]<2)
  522.                       continue;
  523.                 if (map[top+1][topoffset+1]==3)
  524.                   {
  525.                       ObjCode = "#";
  526.                       SetAPen(Rp,2);
  527.                       goto next1;
  528.                   }
  529.                 if (map[top+1][topoffset+1]==4)
  530.                   {
  531.                       ObjCode = "$";
  532.                       SetAPen(Rp,2);
  533.                       goto next1;
  534.                   }
  535.                 if (map[top+1][topoffset+1]==2)
  536.                   {
  537.                       ObjCode = "%";
  538.                       SetAPen(Rp,2);
  539.                       goto next1;
  540.                   }
  541.                 if (map[top+1][topoffset+1]==34)
  542.                   {
  543.                       ObjCode = "6";
  544.                       SetAPen(Rp,2);
  545.                       goto next1;
  546.                   }
  547.                 if (map[top+1][topoffset+1]==22)
  548.                   {
  549.                       ObjCode = "6";
  550.                       SetAPen(Rp,3);
  551.                       goto next1;
  552.                   }
  553.                 if (map[top+1][topoffset+1]==87)
  554.                   {
  555.                       ObjCode = "<";
  556.                       SetAPen(Rp,2);
  557.                       goto next1;
  558.                   }
  559.                 if (map[top+1][topoffset+1]==85)
  560.                   {
  561.                       ObjCode = "<";
  562.                       SetAPen(Rp,3);
  563.                       goto next1;
  564.                   }
  565.                 if (map[top+1][topoffset+1]==67)
  566.                   {
  567.                       ObjCode = "@";
  568.                       SetAPen(Rp,2);
  569.                       goto next1;
  570.                   }
  571.                 if (map[top+1][topoffset+1]==44)
  572.                   {
  573.                       ObjCode = "@";
  574.                       SetAPen(Rp,3);
  575.                       goto next1;
  576.                   }
  577.                 if (map[top+1][topoffset+1]==11)
  578.                   {
  579.                       ObjCode = "+";
  580.                       SetAPen(Rp,1);
  581.                       goto next1;
  582.                   }
  583.                 if (map[top+1][topoffset+1]==71)
  584.                   {
  585.                       ObjCode = "D";
  586.                       SetAPen(Rp,2);
  587.                       goto next1;
  588.                   }
  589.                 if (map[top+1][topoffset+1]==48)
  590.                   {
  591.                       ObjCode = "D";
  592.                       SetAPen(Rp,3);
  593.                       goto next1;
  594.                   }
  595.                 if (map[top+1][topoffset+1]==92)
  596.                   {
  597.                       ObjCode = "5";
  598.                       SetAPen(Rp,2);
  599.                       goto next1;
  600.                   }
  601.                 if (map[top+1][topoffset+1]==89)
  602.                   {
  603.                       ObjCode = "5";
  604.                       SetAPen(Rp,3);
  605.                       goto next1;
  606.                   }
  607.                 if (map[top+1][topoffset+1]==37)
  608.                   {
  609.                       ObjCode = "9";
  610.                       SetAPen(Rp,2);
  611.                       goto next1;
  612.                   }
  613.                 if (map[top+1][topoffset+1]==25)
  614.                   {
  615.                       ObjCode = "9";
  616.                       SetAPen(Rp,3);
  617.                       goto next1;
  618.                   }
  619.                 if (map[top+1][topoffset+1]==14)
  620.                   {
  621.                       ObjCode = ".";
  622.                       SetAPen(Rp,1);
  623.                       goto next1;
  624.                   }
  625.                 if (map[top+1][topoffset+1]==32)
  626.                   {
  627.                       ObjCode = "4";
  628.                       SetAPen(Rp,2);
  629.                       goto next1;
  630.                   }
  631.                 if (map[top+1][topoffset+1]==20)
  632.                   {
  633.                       ObjCode = "4";
  634.                       SetAPen(Rp,3);
  635.                       goto next1;
  636.                   }
  637.                 if (map[top+1][topoffset+1]==15)
  638.                   {
  639.                       ObjCode = "/";
  640.                       SetAPen(Rp,1);
  641.                       goto next1;
  642.                   }
  643.                 if (map[top+1][topoffset+1]==65)
  644.                   {
  645.                       ObjCode = ">";
  646.                       SetAPen(Rp,2);
  647.                       goto next1;
  648.                   }
  649.                 if (map[top+1][topoffset+1]==42)
  650.                   {
  651.                       ObjCode = ">";
  652.                       SetAPen(Rp,3);
  653.                       goto next1;
  654.                   }
  655.                 if (map[top+1][topoffset+1]==36)
  656.                   {
  657.                       ObjCode = "8";
  658.                       SetAPen(Rp,2);
  659.                       goto next1;
  660.                   }
  661.                 if (map[top+1][topoffset+1]==24)
  662.                   {
  663.                       ObjCode = "8";
  664.                       SetAPen(Rp,3);
  665.                       goto next1;
  666.                   }
  667.                 if (map[top+1][topoffset+1]==29)
  668.                   {
  669.                       ObjCode = "1";
  670.                       SetAPen(Rp,2);
  671.                       goto next1;
  672.                   }
  673.                 if (map[top+1][topoffset+1]==17)
  674.                   {
  675.                       ObjCode = "1";
  676.                       SetAPen(Rp,3);
  677.                       goto next1;
  678.                   }
  679.                 if (map[top+1][topoffset+1]==31)
  680.                   {
  681.                       ObjCode = "3";
  682.                       SetAPen(Rp,2);
  683.                       goto next1;
  684.                   }
  685.                 if (map[top+1][topoffset+1]==19)
  686.                   {
  687.                       ObjCode = "3";
  688.                       SetAPen(Rp,3);
  689.                       goto next1;
  690.                   }
  691.                 if (map[top+1][topoffset+1]==10)
  692.                   {
  693.                       ObjCode = "*";
  694.                       SetAPen(Rp,1);
  695.                       goto next1;
  696.                   }
  697.                 if (map[top+1][topoffset+1]==7)
  698.                   {
  699.                       ObjCode = "'";
  700.                       SetAPen(Rp,1);
  701.                       goto next1;
  702.                   }
  703.                 if (map[top+1][topoffset+1]==66)
  704.                   {
  705.                       ObjCode = "?";
  706.                       SetAPen(Rp,2);
  707.                       goto next1;
  708.                   }
  709.                 if (map[top+1][topoffset+1]==43)
  710.                   {
  711.                       ObjCode = "?";
  712.                       SetAPen(Rp,3);
  713.                       goto next1;
  714.                   }
  715.                 if (map[top+1][topoffset+1]==6)
  716.                   {
  717.                       ObjCode = "&";
  718.                       SetAPen(Rp,1);
  719.                       goto next1;
  720.                   }
  721.                 if (map[top+1][topoffset+1]==12)
  722.                   {
  723.                       ObjCode = ",";
  724.                       SetAPen(Rp,1);
  725.                       goto next1;
  726.                   }
  727.                 if (map[top+1][topoffset+1]==13)
  728.                   {
  729.                       ObjCode = "-";
  730.                       SetAPen(Rp,1);
  731.                       goto next1;
  732.                   }
  733.                 if (map[top+1][topoffset+1]==73)
  734.                   {
  735.                       ObjCode = "C";
  736.                       SetAPen(Rp,2);
  737.                       goto next1;
  738.                   }
  739.                 if (map[top+1][topoffset+1]==50)
  740.                   {
  741.                       ObjCode = "C";
  742.                       SetAPen(Rp,3);
  743.                       goto next1;
  744.                   }
  745.                 if (map[top+1][topoffset+1]==39)
  746.                   {
  747.                       ObjCode = ";";
  748.                       SetAPen(Rp,2);
  749.                       goto next1;
  750.                   }
  751.                 if (map[top+1][topoffset+1]==27)
  752.                   {
  753.                       ObjCode = ";";
  754.                       SetAPen(Rp,3);
  755.                       goto next1;
  756.                   }
  757.                 if (map[top+1][topoffset+1]==8)
  758.                   {
  759.                       ObjCode = "(";
  760.                       SetAPen(Rp,1);
  761.                       goto next1;
  762.                   }
  763.                 if (map[top+1][topoffset+1]==5)
  764.                   {
  765.                       ObjCode = ")";
  766.                       SetAPen(Rp,1);
  767.                       goto next1;
  768.                   }
  769.                 if (map[top+1][topoffset+1]==64)
  770.                   {
  771.                       ObjCode = "A";
  772.                       SetAPen(Rp,2);
  773.                       goto next1;
  774.                   }
  775.                 if (map[top+1][topoffset+1]==41)
  776.                   {
  777.                       ObjCode = "A";
  778.                       SetAPen(Rp,3);
  779.                       goto next1;
  780.                   }
  781.                 if (map[top+1][topoffset+1]==30)
  782.                   {
  783.                       ObjCode = "2";
  784.                       SetAPen(Rp,2);
  785.                       goto next1;
  786.                   }
  787.                 if (map[top+1][topoffset+1]==18)
  788.                   {
  789.                       ObjCode = "2";
  790.                       SetAPen(Rp,3);
  791.                       goto next1;
  792.                   }
  793.                 if (map[top+1][topoffset+1]==16)
  794.                   {
  795.                       ObjCode = "0";
  796.                       SetAPen(Rp,1);
  797.                       goto next1;
  798.                   }
  799.                 if (map[top+1][topoffset+1]==70)
  800.                   {
  801.                       ObjCode = "B";
  802.                       SetAPen(Rp,2);
  803.                       goto next1;
  804.                   }
  805.                 if (map[top+1][topoffset+1]==47)
  806.                   {
  807.                       ObjCode = "B";
  808.                       SetAPen(Rp,3);
  809.                       goto next1;
  810.                   }
  811.                       continue;
  812.  
  813.                next1: PrintAt(top*9+3,20,ObjCode);
  814.  
  815.             } /* End of FOR loop */
  816.  
  817.          ObjCode = TempCode;
  818.          SetAPen(Rp,1);
  819.      }
  820. }
  821.  
  822. ScrollDn()        /* This routine will scroll the screen up 9 pixels and */
  823. {                 /* print a new line of data at bottom of map */
  824.    int top;
  825.    char *TempCode;
  826.    if (topoffset < 21)
  827.      {
  828.          TempCode = ObjCode;
  829.          MyBob->X = 650;
  830.          MyBob->Y = 410;
  831.          UpdateBob();
  832.          ScrollRaster(Rp,0,9,3,11,579,397);
  833.          topoffset += 1;
  834.  
  835.          for (top=0;top<64;top++)
  836.             {
  837.                 if (map[top+1][topoffset+43]<2)
  838.                       continue;
  839.                 if (map[top+1][topoffset+43]==3)
  840.                   {
  841.                       ObjCode = "#";
  842.                       SetAPen(Rp,2);
  843.                       goto next2;
  844.                   }
  845.                 if (map[top+1][topoffset+43]==4)
  846.                   {
  847.                       ObjCode = "$";
  848.                       SetAPen(Rp,2);
  849.                       goto next2;
  850.                   }
  851.                 if (map[top+1][topoffset+43]==2)
  852.                   {
  853.                       ObjCode = "%";
  854.                       SetAPen(Rp,2);
  855.                       goto next2;
  856.                   }
  857.                 if (map[top+1][topoffset+43]==34)
  858.                   {
  859.                       ObjCode = "6";
  860.                       SetAPen(Rp,2);
  861.                       goto next2;
  862.                   }
  863.                 if (map[top+1][topoffset+43]==22)
  864.                   {
  865.                       ObjCode = "6";
  866.                       SetAPen(Rp,3);
  867.                       goto next2;
  868.                   }
  869.                 if (map[top+1][topoffset+43]==87)
  870.                   {
  871.                       ObjCode = "<";
  872.                       SetAPen(Rp,2);
  873.                       goto next2;
  874.                   }
  875.                 if (map[top+1][topoffset+43]==85)
  876.                   {
  877.                       ObjCode = "<";
  878.                       SetAPen(Rp,3);
  879.                       goto next2;
  880.                   }
  881.                 if (map[top+1][topoffset+43]==67)
  882.                   {
  883.                       ObjCode = "@";
  884.                       SetAPen(Rp,2);
  885.                       goto next2;
  886.                   }
  887.                 if (map[top+1][topoffset+43]==44)
  888.                   {
  889.                       ObjCode = "@";
  890.                       SetAPen(Rp,3);
  891.                       goto next2;
  892.                   }
  893.                 if (map[top+1][topoffset+43]==11)
  894.                   {
  895.                       ObjCode = "+";
  896.                       SetAPen(Rp,1);
  897.                       goto next2;
  898.                   }
  899.                 if (map[top+1][topoffset+43]==71)
  900.                   {
  901.                       ObjCode = "D";
  902.                       SetAPen(Rp,2);
  903.                       goto next2;
  904.                   }
  905.                 if (map[top+1][topoffset+43]==48)
  906.                   {
  907.                       ObjCode = "D";
  908.                       SetAPen(Rp,3);
  909.                       goto next2;
  910.                   }
  911.                 if (map[top+1][topoffset+43]==92)
  912.                   {
  913.                       ObjCode = "5";
  914.                       SetAPen(Rp,2);
  915.                       goto next2;
  916.                   }
  917.                 if (map[top+1][topoffset+43]==89)
  918.                   {
  919.                       ObjCode = "5";
  920.                       SetAPen(Rp,3);
  921.                       goto next2;
  922.                   }
  923.                 if (map[top+1][topoffset+43]==37)
  924.                   {
  925.                       ObjCode = "9";
  926.                       SetAPen(Rp,2);
  927.                       goto next2;
  928.                   }
  929.                 if (map[top+1][topoffset+43]==25)
  930.                   {
  931.                       ObjCode = "9";
  932.                       SetAPen(Rp,3);
  933.                       goto next2;
  934.                   }
  935.                 if (map[top+1][topoffset+43]==14)
  936.                   {
  937.                       ObjCode = ".";
  938.                       SetAPen(Rp,1);
  939.                       goto next2;
  940.                   }
  941.                 if (map[top+1][topoffset+43]==32)
  942.                   {
  943.                       ObjCode = "4";
  944.                       SetAPen(Rp,2);
  945.                       goto next2;
  946.                   }
  947.                 if (map[top+1][topoffset+43]==20)
  948.                   {
  949.                       ObjCode = "4";
  950.                       SetAPen(Rp,3);
  951.                       goto next2;
  952.                   }
  953.                 if (map[top+1][topoffset+43]==15)
  954.                   {
  955.                       ObjCode = "/";
  956.                       SetAPen(Rp,1);
  957.                       goto next2;
  958.                   }
  959.                 if (map[top+1][topoffset+43]==65)
  960.                   {
  961.                       ObjCode = ">";
  962.                       SetAPen(Rp,2);
  963.                       goto next2;
  964.                   }
  965.                 if (map[top+1][topoffset+43]==42)
  966.                   {
  967.                       ObjCode = ">";
  968.                       SetAPen(Rp,3);
  969.                       goto next2;
  970.                   }
  971.                 if (map[top+1][topoffset+43]==36)
  972.                   {
  973.                       ObjCode = "8";
  974.                       SetAPen(Rp,2);
  975.                       goto next2;
  976.                   }
  977.                 if (map[top+1][topoffset+43]==24)
  978.                   {
  979.                       ObjCode = "8";
  980.                       SetAPen(Rp,3);
  981.                       goto next2;
  982.                   }
  983.                 if (map[top+1][topoffset+43]==29)
  984.                   {
  985.                       ObjCode = "1";
  986.                       SetAPen(Rp,2);
  987.                       goto next2;
  988.                   }
  989.                 if (map[top+1][topoffset+43]==17)
  990.                   {
  991.                       ObjCode = "1";
  992.                       SetAPen(Rp,3);
  993.                       goto next2;
  994.                   }
  995.                 if (map[top+1][topoffset+43]==31)
  996.                   {
  997.                       ObjCode = "3";
  998.                       SetAPen(Rp,2);
  999.                       goto next2;
  1000.                   }
  1001.                 if (map[top+1][topoffset+43]==19)
  1002.                   {
  1003.                       ObjCode = "3";
  1004.                       SetAPen(Rp,3);
  1005.                       goto next2;
  1006.                   }
  1007.                 if (map[top+1][topoffset+43]==10)
  1008.                   {
  1009.                       ObjCode = "*";
  1010.                       SetAPen(Rp,1);
  1011.                       goto next2;
  1012.                   }
  1013.                 if (map[top+1][topoffset+43]==7)
  1014.                   {
  1015.                       ObjCode = "'";
  1016.                       SetAPen(Rp,1);
  1017.                       goto next2;
  1018.                   }
  1019.                 if (map[top+1][topoffset+43]==66)
  1020.                   {
  1021.                       ObjCode = "?";
  1022.                       SetAPen(Rp,2);
  1023.                       goto next2;
  1024.                   }
  1025.                 if (map[top+1][topoffset+43]==43)
  1026.                   {
  1027.                       ObjCode = "?";
  1028.                       SetAPen(Rp,3);
  1029.                       goto next2;
  1030.                   }
  1031.                 if (map[top+1][topoffset+43]==6)
  1032.                   {
  1033.                       ObjCode = "&";
  1034.                       SetAPen(Rp,1);
  1035.                       goto next2;
  1036.                   }
  1037.                 if (map[top+1][topoffset+43]==12)
  1038.                   {
  1039.                       ObjCode = ",";
  1040.                       SetAPen(Rp,1);
  1041.                       goto next2;
  1042.                   }
  1043.                 if (map[top+1][topoffset+43]==13)
  1044.                   {
  1045.                       ObjCode = "-";
  1046.                       SetAPen(Rp,1);
  1047.                       goto next2;
  1048.                   }
  1049.                 if (map[top+1][topoffset+43]==73)
  1050.                   {
  1051.                       ObjCode = "C";
  1052.                       SetAPen(Rp,2);
  1053.                       goto next2;
  1054.                   }
  1055.                 if (map[top+1][topoffset+43]==50)
  1056.                   {
  1057.                       ObjCode = "C";
  1058.                       SetAPen(Rp,3);
  1059.                       goto next2;
  1060.                   }
  1061.                 if (map[top+1][topoffset+43]==39)
  1062.                   {
  1063.                       ObjCode = ";";
  1064.                       SetAPen(Rp,2);
  1065.                       goto next2;
  1066.                   }
  1067.                 if (map[top+1][topoffset+43]==27)
  1068.                   {
  1069.                       ObjCode = ";";
  1070.                       SetAPen(Rp,3);
  1071.                       goto next2;
  1072.                   }
  1073.                 if (map[top+1][topoffset+43]==8)
  1074.                   {
  1075.                       ObjCode = "(";
  1076.                       SetAPen(Rp,1);
  1077.                       goto next2;
  1078.                   }
  1079.                 if (map[top+1][topoffset+43]==5)
  1080.                   {
  1081.                       ObjCode = ")";
  1082.                       SetAPen(Rp,1);
  1083.                       goto next2;
  1084.                   }
  1085.                 if (map[top+1][topoffset+43]==64)
  1086.                   {
  1087.                       ObjCode = "A";
  1088.                       SetAPen(Rp,2);
  1089.                       goto next2;
  1090.                   }
  1091.                 if (map[top+1][topoffset+43]==41)
  1092.                   {
  1093.                       ObjCode = "A";
  1094.                       SetAPen(Rp,3);
  1095.                       goto next2;
  1096.                   }
  1097.                 if (map[top+1][topoffset+43]==30)
  1098.                   {
  1099.                       ObjCode = "2";
  1100.                       SetAPen(Rp,2);
  1101.                       goto next2;
  1102.                   }
  1103.                 if (map[top+1][topoffset+43]==18)
  1104.                   {
  1105.                       ObjCode = "2";
  1106.                       SetAPen(Rp,3);
  1107.                       goto next2;
  1108.                   }
  1109.                 if (map[top+1][topoffset+43]==16)
  1110.                   {
  1111.                       ObjCode = "0";
  1112.                       SetAPen(Rp,1);
  1113.                       goto next2;
  1114.                   }
  1115.                 if (map[top+1][topoffset+43]==70)
  1116.                   {
  1117.                       ObjCode = "B";
  1118.                       SetAPen(Rp,2);
  1119.                       goto next2;
  1120.                   }
  1121.                 if (map[top+1][topoffset+43]==47)
  1122.                   {
  1123.                       ObjCode = "B";
  1124.                       SetAPen(Rp,3);
  1125.                       goto next2;
  1126.                   }
  1127.                       continue;
  1128.  
  1129.                next2: PrintAt(top*9+3,398,ObjCode);
  1130.  
  1131.            } /* End of FOR loop */
  1132.  
  1133.          ObjCode = TempCode;
  1134.          SetAPen(Rp,1);
  1135.      }
  1136. }
  1137.  
  1138. ClrScr()          /* This routine will clear the maps' screen */
  1139. {
  1140.    int ly;
  1141.    for (ly=20;ly < 399;ly += 9)
  1142.    PrintAt(3,ly,"                                                                ");
  1143. }
  1144.  
  1145. PlaceObj()       /* This routine will place an object on the map.If it is */
  1146. {                /* the same piece, it will erase it. */
  1147.    int gridx, gridy;
  1148.    gridx = x/9;
  1149.    gridy = y/9-1;
  1150.    if ((gridx<1) || (gridx>64) || (gridy<1) || (gridy>43))
  1151.       return();
  1152.    if (pen==3)
  1153.       SetAPen(Rp,3);
  1154.    if (pen==2)
  1155.       SetAPen(Rp,2);
  1156.    if (roadpen==1)
  1157.       SetAPen(Rp,1);
  1158.    if ((ObjValue==2) || (ObjValue==3) || (ObjValue==4))
  1159.       SetAPen(Rp,2);
  1160.    MyBob->X = 650;
  1161.    MyBob->Y = 410;
  1162.    UpdateBob();
  1163.  
  1164.    if ((map[gridx][gridy+topoffset] > 1) && (map[gridx][gridy+topoffset] == ObjValue))
  1165.       {
  1166.         rndnum = ran()*2;
  1167.         map[gridx][gridy+topoffset] = rndnum;
  1168.         PrintAt((x/9)*9-6,(y/9)*9+2," ");
  1169.       }
  1170.    else
  1171.       {
  1172.         map[gridx][gridy+topoffset] = ObjValue;
  1173.         PrintAt((x/9)*9-6,(y/9)*9+2,ObjCode);
  1174.       }
  1175.    SetAPen(Rp,1);
  1176. }
  1177.  
  1178. ObjSelect()   /* This routine will call upon other routines to assign */
  1179. {             /* the selected object. It also sets color to green or brown */
  1180.    MyBob->X = 650;
  1181.    MyBob->Y = 410;
  1182.    UpdateBob();
  1183.  
  1184.    if ((x>590) && (x<609) && (y>17) && (y<28))
  1185.      {
  1186.          MyBob->X = 650;
  1187.          MyBob->Y = 410;
  1188.          UpdateBob();
  1189.          SetAPen(Rp,0);
  1190.          RectFill(Rp,613,15,632,26);
  1191.          SetAPen(Rp,2);
  1192.          RectFill(Rp,614,16,631,25);
  1193.          SetAPen(Rp,1);
  1194.          RectFill(Rp,588,15,607,26);
  1195.          SetAPen(Rp,3);
  1196.          RectFill(Rp,590,17,605,24);
  1197.          pen = 3;
  1198.          DeleteVSprite(MyBob);
  1199.          MyBob = MakeBob(650,410,9,1,2,blank,0x03,0x00);
  1200.          AddBob(MyBob->VSBob,Rp);
  1201.          ObjCode = " ";
  1202.          SetAPen(Rp,1);
  1203.          return();
  1204.      }
  1205.  
  1206.    if ((x>615) && (x<634) && (y>17) && (y<28))
  1207.      {
  1208.          MyBob->X = 650;
  1209.          MyBob->Y = 410;
  1210.          UpdateBob();
  1211.          SetAPen(Rp,0);
  1212.          RectFill(Rp,588,15,607,26);
  1213.          SetAPen(Rp,3);
  1214.          RectFill(Rp,589,16,606,25);
  1215.          SetAPen(Rp,1);
  1216.          RectFill(Rp,613,15,632,26);
  1217.          SetAPen(Rp,2);
  1218.          RectFill(Rp,615,17,630,24);
  1219.          pen = 2;
  1220.          DeleteVSprite(MyBob);
  1221.          MyBob = MakeBob(650,410,9,1,2,blank,0x03,0x00);
  1222.          AddBob(MyBob->VSBob,Rp);
  1223.          ObjCode = " ";
  1224.          SetAPen(Rp,1);
  1225.          return();
  1226.      }
  1227.  
  1228.    if (pen == 2)
  1229.       SelectGreen();
  1230.    if (pen == 3)
  1231.       SelectBrown();
  1232. }
  1233.  
  1234. SelectGreen()     /* This routine will assign a green colored object */
  1235. {
  1236.    if ((x>592) && (x<606) && (y>49) && (y<61))
  1237.      {
  1238.          MyBob->X = 650;
  1239.          MyBob->Y = 410;
  1240.          UpdateBob();
  1241.          DeleteVSprite(MyBob);
  1242.          MyBob = MakeBob(650,410,9,1,2,horwall,0x03,0x00);
  1243.          AddBob(MyBob->VSBob,Rp);
  1244.          ObjCode = ">";
  1245.          ObjValue = 65;
  1246.          roadpen = 0;
  1247.          return();
  1248.      }
  1249.    else if ((x>617) && (x<631) && (y>49) && (y<61))
  1250.        {
  1251.            MyBob->X = 650;
  1252.            MyBob->Y = 410;
  1253.            UpdateBob();
  1254.            DeleteVSprite(MyBob);
  1255.            MyBob = MakeBob(650,410,9,1,2,verwall,0x03,0x00);
  1256.            AddBob(MyBob->VSBob,Rp);
  1257.            ObjCode = "B";
  1258.            ObjValue = 70;
  1259.            roadpen = 0;
  1260.            return();
  1261.        }
  1262.    else if ((x>592) && (x<606) && (y>67) && (y<79))
  1263.        {
  1264.            MyBob->X = 650;
  1265.            MyBob->Y = 410;
  1266.            UpdateBob();
  1267.            DeleteVSprite(MyBob);
  1268.            MyBob = MakeBob(650,410,9,1,2,urtur,0x03,0x00);
  1269.            AddBob(MyBob->VSBob,Rp);
  1270.            ObjCode = "A";
  1271.            ObjValue = 64;
  1272.            roadpen = 0;
  1273.            return();
  1274.        }
  1275.    else if ((x>617) && (x<631) && (y>67) && (y<79))
  1276.        {
  1277.            MyBob->X = 650;
  1278.            MyBob->Y = 410;
  1279.            UpdateBob();
  1280.            DeleteVSprite(MyBob);
  1281.            MyBob = MakeBob(650,410,9,1,2,rdtur,0x03,0x00);
  1282.            AddBob(MyBob->VSBob,Rp);
  1283.            ObjCode = "?";
  1284.            ObjValue = 66;
  1285.            roadpen = 0;
  1286.            return();
  1287.        }
  1288.    else if ((x>592) && (x<606) && (y>85) && (y<97))
  1289.        { 
  1290.            MyBob->X = 650;
  1291.            MyBob->Y = 410;
  1292.            UpdateBob();
  1293.            DeleteVSprite(MyBob);
  1294.            MyBob = MakeBob(650,410,9,1,2,drtur,0x03,0x00);
  1295.            AddBob(MyBob->VSBob,Rp);
  1296.            ObjCode = "D";
  1297.            ObjValue = 71;
  1298.            roadpen = 0;
  1299.            return();
  1300.        }
  1301.    else if ((x>617) && (x<631) && (y>85) && (y<97))
  1302.        {
  1303.            MyBob->X = 650;
  1304.            MyBob->Y = 410;
  1305.            UpdateBob();
  1306.            DeleteVSprite(MyBob);
  1307.            MyBob = MakeBob(650,410,9,1,2,rutur,0x03,0x00);
  1308.            AddBob(MyBob->VSBob,Rp);
  1309.            ObjCode = "C";
  1310.            ObjValue = 73;
  1311.            roadpen = 0;
  1312.            return();
  1313.        }
  1314.    else if ((x>592) && (x<606) && (y>103) && (y<115))
  1315.        {
  1316.            MyBob->X = 650;
  1317.            MyBob->Y = 410;
  1318.            UpdateBob();
  1319.            DeleteVSprite(MyBob);
  1320.            MyBob = MakeBob(650,410,9,1,2,horroad,0x03,0x00);
  1321.            AddBob(MyBob->VSBob,Rp);
  1322.            ObjCode = "/";
  1323.            ObjValue = 15;
  1324.            roadpen = 1;
  1325.            return();
  1326.        }
  1327.    else if ((x>617) && (x<631) && (y>103) && (y<115))
  1328.        {
  1329.            MyBob->X = 650;
  1330.            MyBob->Y = 410;
  1331.            UpdateBob();
  1332.            DeleteVSprite(MyBob);
  1333.            MyBob = MakeBob(650,410,9,1,2,verroad,0x03,0x00);
  1334.            AddBob(MyBob->VSBob,Rp);
  1335.            ObjCode = "0";
  1336.            ObjValue = 16;
  1337.            roadpen = 1;
  1338.            return();
  1339.        }
  1340.    else if ((x>592) && (x<606) && (y>121) && (y<133))
  1341.        {
  1342.            MyBob->X = 650;
  1343.            MyBob->Y = 410;
  1344.            UpdateBob();
  1345.            DeleteVSprite(MyBob);
  1346.            MyBob = MakeBob(650,410,9,1,2,urroad,0x03,0x00);
  1347.            AddBob(MyBob->VSBob,Rp);
  1348.            ObjCode = ")";
  1349.            ObjValue = 5;
  1350.            roadpen = 1;
  1351.            return();
  1352.        }
  1353.    else if ((x>617) && (x<631) && (y>121) && (y<133))
  1354.        {
  1355.            MyBob->X = 650;
  1356.            MyBob->Y = 410;
  1357.            UpdateBob();
  1358.            DeleteVSprite(MyBob);
  1359.            MyBob = MakeBob(650,410,9,1,2,rdroad,0x03,0x00);
  1360.            AddBob(MyBob->VSBob,Rp);
  1361.            ObjCode = "'";
  1362.            ObjValue = 7;
  1363.            roadpen = 1;
  1364.            return();
  1365.        }
  1366.    else if ((x>592) && (x<606) && (y>139) && (y<151))
  1367.        {
  1368.            MyBob->X = 650;
  1369.            MyBob->Y = 410;
  1370.            UpdateBob();
  1371.            DeleteVSprite(MyBob);
  1372.            MyBob = MakeBob(650,410,9,1,2,drroad,0x03,0x00);
  1373.            AddBob(MyBob->VSBob,Rp);
  1374.            ObjCode = "+";
  1375.            ObjValue = 11;
  1376.            roadpen = 1;
  1377.            return();
  1378.        }
  1379.    else if ((x>617) && (x<631) && (y>139) && (y<151))
  1380.        {
  1381.            MyBob->X = 650;
  1382.            MyBob->Y = 410;
  1383.            UpdateBob();
  1384.            DeleteVSprite(MyBob);
  1385.            MyBob = MakeBob(650,410,9,1,2,ruroad,0x03,0x00);
  1386.            AddBob(MyBob->VSBob,Rp);
  1387.            ObjCode = "-";
  1388.            ObjValue = 13;
  1389.            roadpen = 1;
  1390.            return();
  1391.        }
  1392.    else if ((x>592) && (x<606) && (y>157) && (y<169))
  1393.        {
  1394.            MyBob->X = 650;
  1395.            MyBob->Y = 410;
  1396.            UpdateBob();
  1397.            DeleteVSprite(MyBob);
  1398.            MyBob = MakeBob(650,410,9,1,2,udrroad,0x03,0x00);
  1399.            AddBob(MyBob->VSBob,Rp);
  1400.            ObjCode = "(";
  1401.            ObjValue = 8;
  1402.            roadpen = 1;
  1403.            return();
  1404.        }
  1405.    else if ((x>617) && (x<631) && (y>157) && (y<169))
  1406.        {
  1407.            MyBob->X = 650;
  1408.            MyBob->Y = 410;
  1409.            UpdateBob();
  1410.            DeleteVSprite(MyBob);
  1411.            MyBob = MakeBob(650,410,9,1,2,rudroad,0x03,0x00);
  1412.            AddBob(MyBob->VSBob,Rp);
  1413.            ObjCode = "*";
  1414.            ObjValue = 10;
  1415.            roadpen = 1;
  1416.            return();
  1417.        }
  1418.    else if ((x>592) && (x<606) && (y>175) && (y<187))
  1419.        {
  1420.            MyBob->X = 650;
  1421.            MyBob->Y = 410;
  1422.            UpdateBob();
  1423.            DeleteVSprite(MyBob);
  1424.            MyBob = MakeBob(650,410,9,1,2,lrdroad,0x03,0x00);
  1425.            AddBob(MyBob->VSBob,Rp);
  1426.            ObjCode = "&";
  1427.            ObjValue = 6;
  1428.            roadpen = 1;
  1429.            return();
  1430.        }
  1431.    else if ((x>617) && (x<631) && (y>175) && (y<187))
  1432.        {
  1433.            MyBob->X = 650;
  1434.            MyBob->Y = 410;
  1435.            UpdateBob();
  1436.            DeleteVSprite(MyBob);
  1437.            MyBob = MakeBob(650,410,9,1,2,lruroad,0x03,0x00);
  1438.            AddBob(MyBob->VSBob,Rp);
  1439.            ObjCode = ",";
  1440.            ObjValue = 12;
  1441.            roadpen = 1;
  1442.            return();
  1443.        }
  1444.    else if ((x>592) && (x<606) && (y>193) && (y<205))
  1445.        {
  1446.            MyBob->X = 650;
  1447.            MyBob->Y = 410;
  1448.            UpdateBob();
  1449.            DeleteVSprite(MyBob);
  1450.            MyBob = MakeBob(650,410,9,1,2,crsturret,0x03,0x00);
  1451.            AddBob(MyBob->VSBob,Rp);
  1452.            ObjCode = "<";
  1453.            ObjValue = 87;
  1454.            roadpen = 0;
  1455.            return();
  1456.        }
  1457.    else if ((x>617) && (x<631) && (y>193) && (y<205))
  1458.        {
  1459.            MyBob->X = 650;
  1460.            MyBob->Y = 410;
  1461.            UpdateBob();
  1462.            DeleteVSprite(MyBob);
  1463.            MyBob = MakeBob(650,410,9,1,2,turret,0x03,0x00);
  1464.            AddBob(MyBob->VSBob,Rp);
  1465.            ObjCode = ";";
  1466.            ObjValue = 39;
  1467.            roadpen = 0;
  1468.            return();
  1469.        }
  1470.    else if ((x>592) && (x<606) && (y>211) && (y<223))
  1471.        {
  1472.            MyBob->X = 650;
  1473.            MyBob->Y = 410;
  1474.            UpdateBob();
  1475.            DeleteVSprite(MyBob);
  1476.            MyBob = MakeBob(650,410,9,1,2,door,0x03,0x00);
  1477.            AddBob(MyBob->VSBob,Rp);
  1478.            ObjCode = "@";
  1479.            ObjValue = 67;
  1480.            roadpen = 0;
  1481.            return();
  1482.        }
  1483.    else if ((x>617) && (x<631) && (y>211) && (y<223))
  1484.        {
  1485.            MyBob->X = 650;
  1486.            MyBob->Y = 410;
  1487.            UpdateBob();
  1488.            DeleteVSprite(MyBob);
  1489.            MyBob = MakeBob(650,410,9,1,2,fuel,0x03,0x00);
  1490.            AddBob(MyBob->VSBob,Rp);
  1491.            ObjCode = "9";
  1492.            ObjValue = 37;
  1493.            roadpen = 0;
  1494.            return();
  1495.        }
  1496.    else if ((x>592) && (x<606) && (y>229) && (y<241))
  1497.        {
  1498.            MyBob->X = 650;
  1499.            MyBob->Y = 410;
  1500.            UpdateBob();
  1501.            DeleteVSprite(MyBob);
  1502.            MyBob = MakeBob(650,410,9,1,2,helipad,0x03,0x00);
  1503.            AddBob(MyBob->VSBob,Rp);
  1504.            ObjCode = ".";
  1505.            ObjValue = 14;
  1506.            roadpen = 1;
  1507.            return();
  1508.        }
  1509.    else if ((x>617) && (x<631) && (y>229) && (y<241))
  1510.        {
  1511.            MyBob->X = 650;
  1512.            MyBob->Y = 410;
  1513.            UpdateBob();
  1514.            DeleteVSprite(MyBob);
  1515.            MyBob = MakeBob(650,410,9,1,2,barracks,0x03,0x00);
  1516.            AddBob(MyBob->VSBob,Rp);
  1517.            ObjCode = "6";
  1518.            ObjValue = 34;
  1519.            roadpen = 0;
  1520.            return();
  1521.        }
  1522.    else if ((x>592) && (x<606) && (y>247) && (y<259))
  1523.        {
  1524.            MyBob->X = 650;
  1525.            MyBob->Y = 410;
  1526.            UpdateBob();
  1527.            DeleteVSprite(MyBob);
  1528.            MyBob = MakeBob(650,410,9,1,2,home,0x03,0x00);
  1529.            AddBob(MyBob->VSBob,Rp);
  1530.            ObjCode = "4";
  1531.            ObjValue = 32;
  1532.            roadpen = 0;
  1533.            return();
  1534.        }
  1535.    else if ((x>617) && (x<631) && (y>247) && (y<259))
  1536.        {
  1537.            MyBob->X = 650;
  1538.            MyBob->Y = 410;
  1539.            UpdateBob();
  1540.            DeleteVSprite(MyBob);
  1541.            MyBob = MakeBob(650,410,9,1,2,medic,0x03,0x00);
  1542.            AddBob(MyBob->VSBob,Rp);
  1543.            ObjCode = "8";
  1544.            ObjValue = 36;
  1545.            roadpen = 0;
  1546.            return();
  1547.        }
  1548.    else if ((x>592) && (x<606) && (y>265) && (y<277))
  1549.        {
  1550.            MyBob->X = 650;
  1551.            MyBob->Y = 410;
  1552.            UpdateBob();
  1553.            DeleteVSprite(MyBob);
  1554.            MyBob = MakeBob(650,410,9,1,2,flg,0x03,0x00);
  1555.            AddBob(MyBob->VSBob,Rp);
  1556.            ObjCode = "5";
  1557.            ObjValue = 92;
  1558.            roadpen = 0;
  1559.            return();
  1560.        }
  1561.    else if ((x>617) && (x<631) && (y>265) && (y<277))
  1562.        {
  1563.            MyBob->X = 650;
  1564.            MyBob->Y = 410;
  1565.            UpdateBob();
  1566.            DeleteVSprite(MyBob);
  1567.            MyBob = MakeBob(650,410,9,1,2,utility,0x03,0x00);
  1568.            AddBob(MyBob->VSBob,Rp);
  1569.            ObjCode = "2";
  1570.            ObjValue = 30;
  1571.            roadpen = 0;
  1572.            return();
  1573.        }
  1574.    else if ((x>592) && (x<606) && (y>283) && (y<295))
  1575.        {
  1576.            MyBob->X = 650;
  1577.            MyBob->Y = 410;
  1578.            UpdateBob();
  1579.            DeleteVSprite(MyBob);
  1580.            MyBob = MakeBob(650,410,9,1,2,officer,0x03,0x00);
  1581.            AddBob(MyBob->VSBob,Rp);
  1582.            ObjCode = "1";
  1583.            ObjValue = 29;
  1584.            roadpen = 0;
  1585.            return();
  1586.        }
  1587.    else if ((x>617) && (x<631) && (y>283) && (y<295))
  1588.        {
  1589.            MyBob->X = 650;
  1590.            MyBob->Y = 410;
  1591.            UpdateBob();
  1592.            DeleteVSprite(MyBob);
  1593.            MyBob = MakeBob(650,410,9,1,2,prisoner,0x03,0x00);
  1594.            AddBob(MyBob->VSBob,Rp);
  1595.            ObjCode = "3";
  1596.            ObjValue = 31;
  1597.            roadpen = 0;
  1598.            return();
  1599.        }
  1600.    else if ((x>592) && (x<606) && (y>301) && (y<313))
  1601.        {
  1602.            MyBob->X = 650;
  1603.            MyBob->Y = 410;
  1604.            UpdateBob();
  1605.            DeleteVSprite(MyBob);
  1606.            MyBob = MakeBob(650,410,9,1,2,smtree,0x03,0x00);
  1607.            AddBob(MyBob->VSBob,Rp);
  1608.            ObjCode = "#";
  1609.            ObjValue = 3;
  1610.            roadpen = 0;
  1611.            return();
  1612.        }
  1613.    else if ((x>617) && (x<631) && (y>301) && (y<313))
  1614.        {
  1615.            MyBob->X = 650;
  1616.            MyBob->Y = 410;
  1617.            UpdateBob();
  1618.            DeleteVSprite(MyBob);
  1619.            MyBob = MakeBob(650,410,9,1,2,medtree,0x03,0x00);
  1620.            AddBob(MyBob->VSBob,Rp);
  1621.            ObjCode = "$";
  1622.            ObjValue = 4;
  1623.            roadpen = 0;
  1624.            return();
  1625.        }
  1626.    else if ((x>592) && (x<606) && (y>319) && (y<331))
  1627.        {
  1628.            MyBob->X = 650;
  1629.            MyBob->Y = 410;
  1630.            UpdateBob();
  1631.            DeleteVSprite(MyBob);
  1632.            MyBob = MakeBob(650,410,9,1,2,bigtree,0x03,0x00);
  1633.            AddBob(MyBob->VSBob,Rp);
  1634.            ObjCode = "%";
  1635.            ObjValue = 2;
  1636.            roadpen = 0;
  1637.            return();
  1638.        }
  1639.    else if ((x>617) && (x<631) && (y>319) && (y<331))
  1640.        {
  1641.            MyBob->X = 650;
  1642.            MyBob->Y = 410;
  1643.            UpdateBob();
  1644.            DeleteVSprite(MyBob);
  1645.            MyBob = MakeBob(650,410,9,1,2,blank,0x03,0x00);
  1646.            AddBob(MyBob->VSBob,Rp);
  1647.            ObjCode = " ";
  1648.            rndnum = ran()*2;
  1649.            ObjValue = rndnum;
  1650.            return();
  1651.        }
  1652.    else if ((x>592) && (x<623) && (y>340) && (y<363))
  1653.             DrawLine();
  1654. }
  1655.  
  1656. SelectBrown()     /* This routine will assign a brown colored object */
  1657. {   
  1658.    if ((x>592) && (x<606) && (y>49) && (y<61))
  1659.      {
  1660.          MyBob->X = 650;
  1661.          MyBob->Y = 410;
  1662.          UpdateBob();
  1663.          DeleteVSprite(MyBob);
  1664.          MyBob = MakeBob(650,410,9,1,2,horwall,0x03,0x00);
  1665.          AddBob(MyBob->VSBob,Rp);
  1666.          ObjCode = ">";
  1667.          ObjValue = 42;
  1668.          roadpen = 0;
  1669.          return();
  1670.      }
  1671.    else if ((x>617) && (x<631) && (y>49) && (y<61))
  1672.        {
  1673.            MyBob->X = 650;
  1674.            MyBob->Y = 410;
  1675.            UpdateBob();
  1676.            DeleteVSprite(MyBob);
  1677.            MyBob = MakeBob(650,410,9,1,2,verwall,0x03,0x00);
  1678.            AddBob(MyBob->VSBob,Rp);
  1679.            ObjCode = "B";
  1680.            ObjValue = 47;
  1681.            roadpen = 0;
  1682.            return();
  1683.        }
  1684.    else if ((x>592) && (x<606) && (y>67) && (y<79))
  1685.        {
  1686.            MyBob->X = 650;
  1687.            MyBob->Y = 410;
  1688.            UpdateBob();
  1689.            DeleteVSprite(MyBob);
  1690.            MyBob = MakeBob(650,410,9,1,2,urtur,0x03,0x00);
  1691.            AddBob(MyBob->VSBob,Rp);
  1692.            ObjCode = "A";
  1693.            ObjValue = 41;
  1694.            roadpen = 0;
  1695.            return();
  1696.        }
  1697.    else if ((x>617) && (x<631) && (y>67) && (y<79))
  1698.        {
  1699.            MyBob->X = 650;
  1700.            MyBob->Y = 410;
  1701.            UpdateBob();
  1702.            DeleteVSprite(MyBob);
  1703.            MyBob = MakeBob(650,410,9,1,2,rdtur,0x03,0x00);
  1704.            AddBob(MyBob->VSBob,Rp);
  1705.            ObjCode = "?";
  1706.            ObjValue = 43;
  1707.            roadpen = 0;
  1708.            return();
  1709.        }
  1710.    else if ((x>592) && (x<606) && (y>85) && (y<97))
  1711.        {
  1712.            MyBob->X = 650;
  1713.            MyBob->Y = 410;
  1714.            UpdateBob();
  1715.            DeleteVSprite(MyBob);
  1716.            MyBob = MakeBob(650,410,9,1,2,drtur,0x03,0x00);
  1717.            AddBob(MyBob->VSBob,Rp);
  1718.            ObjCode = "D";
  1719.            ObjValue = 48;
  1720.            roadpen = 0;
  1721.            return();
  1722.        }
  1723.    else if ((x>617) && (x<631) && (y>85) && (y<97))
  1724.        {
  1725.            MyBob->X = 650;
  1726.            MyBob->Y = 410;
  1727.            UpdateBob();
  1728.            DeleteVSprite(MyBob);
  1729.            MyBob = MakeBob(650,410,9,1,2,rutur,0x03,0x00);
  1730.            AddBob(MyBob->VSBob,Rp);
  1731.            ObjCode = "C";
  1732.            ObjValue = 50;
  1733.            roadpen = 0;
  1734.            return();
  1735.        }
  1736.    else if ((x>592) && (x<606) && (y>103) && (y<115))
  1737.        {
  1738.            MyBob->X = 650;
  1739.            MyBob->Y = 410;
  1740.            UpdateBob();
  1741.            DeleteVSprite(MyBob);
  1742.            MyBob = MakeBob(650,410,9,1,2,horroad,0x03,0x00);
  1743.            AddBob(MyBob->VSBob,Rp);
  1744.            ObjCode = "/";
  1745.            ObjValue = 15;
  1746.            roadpen = 1;
  1747.            return();
  1748.        }
  1749.    else if ((x>617) && (x<631) && (y>103) && (y<115))
  1750.        {
  1751.            MyBob->X = 650;
  1752.            MyBob->Y = 410;
  1753.            UpdateBob();
  1754.            DeleteVSprite(MyBob);
  1755.            MyBob = MakeBob(650,410,9,1,2,verroad,0x03,0x00);
  1756.            AddBob(MyBob->VSBob,Rp);
  1757.            ObjCode = "0";
  1758.            ObjValue = 16;
  1759.            roadpen = 1;
  1760.            return();
  1761.        }
  1762.    else if ((x>592) && (x<606) && (y>121) && (y<133))
  1763.        {
  1764.            MyBob->X = 650;
  1765.            MyBob->Y = 410;
  1766.            UpdateBob();
  1767.            DeleteVSprite(MyBob);
  1768.            MyBob = MakeBob(650,410,9,1,2,urroad,0x03,0x00);
  1769.            AddBob(MyBob->VSBob,Rp);
  1770.            ObjCode = ")";
  1771.            ObjValue = 5;
  1772.            roadpen = 1;
  1773.            return();
  1774.        }
  1775.    else if ((x>617) && (x<631) && (y>121) && (y<133))
  1776.        {
  1777.            MyBob->X = 650;
  1778.            MyBob->Y = 410;
  1779.            UpdateBob();
  1780.            DeleteVSprite(MyBob);
  1781.            MyBob = MakeBob(650,410,9,1,2,rdroad,0x03,0x00);
  1782.            AddBob(MyBob->VSBob,Rp);
  1783.            ObjCode = "'";
  1784.            ObjValue = 7;
  1785.            roadpen = 1;
  1786.            return();
  1787.        }
  1788.    else if ((x>592) && (x<606) && (y>139) && (y<151))
  1789.        {
  1790.            MyBob->X = 650;
  1791.            MyBob->Y = 410;
  1792.            UpdateBob();
  1793.            DeleteVSprite(MyBob);
  1794.            MyBob = MakeBob(650,410,9,1,2,drroad,0x03,0x00);
  1795.            AddBob(MyBob->VSBob,Rp);
  1796.            ObjCode = "+";
  1797.            ObjValue = 11;
  1798.            roadpen = 1;
  1799.            return();
  1800.        }
  1801.    else if ((x>617) && (x<631) && (y>139) && (y<151))
  1802.        {
  1803.            MyBob->X = 650;
  1804.            MyBob->Y = 410;
  1805.            UpdateBob();
  1806.            DeleteVSprite(MyBob);
  1807.            MyBob = MakeBob(650,410,9,1,2,ruroad,0x03,0x00);
  1808.            AddBob(MyBob->VSBob,Rp);
  1809.            ObjCode = "-";
  1810.            ObjValue = 13;
  1811.            roadpen = 1;
  1812.            return();
  1813.        }
  1814.    else if ((x>592) && (x<606) && (y>157) && (y<169))
  1815.        {
  1816.            MyBob->X = 650;
  1817.            MyBob->Y = 410;
  1818.            UpdateBob();
  1819.            DeleteVSprite(MyBob);
  1820.            MyBob = MakeBob(650,410,9,1,2,udrroad,0x03,0x00);
  1821.            AddBob(MyBob->VSBob,Rp);
  1822.            ObjCode = "(";
  1823.            ObjValue = 8;
  1824.            roadpen = 1;
  1825.            return();
  1826.        }
  1827.    else if ((x>617) && (x<631) && (y>157) && (y<169))
  1828.        {
  1829.            MyBob->X = 650;
  1830.            MyBob->Y = 410;
  1831.            UpdateBob();
  1832.            DeleteVSprite(MyBob);
  1833.            MyBob = MakeBob(650,410,9,1,2,rudroad,0x03,0x00);
  1834.            AddBob(MyBob->VSBob,Rp);
  1835.            ObjCode = "*";
  1836.            ObjValue = 10;
  1837.            roadpen = 1;
  1838.            return();
  1839.        }
  1840.    else if ((x>592) && (x<606) && (y>175) && (y<187))
  1841.        {
  1842.            MyBob->X = 650;
  1843.            MyBob->Y = 410;
  1844.            UpdateBob();
  1845.            DeleteVSprite(MyBob);
  1846.            MyBob = MakeBob(650,410,9,1,2,lrdroad,0x03,0x00);
  1847.            AddBob(MyBob->VSBob,Rp);
  1848.            ObjCode = "&";
  1849.            ObjValue = 6;
  1850.            roadpen = 1;
  1851.            return();
  1852.        }   
  1853.    else if ((x>617) && (x<631) && (y>175) && (y<187))
  1854.        {
  1855.            MyBob->X = 650;
  1856.            MyBob->Y = 410;
  1857.            UpdateBob();
  1858.            DeleteVSprite(MyBob);
  1859.            MyBob = MakeBob(650,410,9,1,2,lruroad,0x03,0x00);
  1860.            AddBob(MyBob->VSBob,Rp);
  1861.            ObjCode = ",";
  1862.            ObjValue = 12;
  1863.            roadpen = 1;
  1864.            return();
  1865.        }
  1866.    else if ((x>592) && (x<606) && (y>193) && (y<205))
  1867.        {
  1868.            MyBob->X = 650;
  1869.            MyBob->Y = 410;
  1870.            UpdateBob();
  1871.            DeleteVSprite(MyBob);
  1872.            MyBob = MakeBob(650,410,9,1,2,crsturret,0x03,0x00);
  1873.            AddBob(MyBob->VSBob,Rp);
  1874.            ObjCode = "<";
  1875.            ObjValue = 85;
  1876.            roadpen = 0;
  1877.            return();
  1878.        }
  1879.    else if ((x>617) && (x<631) && (y>193) && (y<205))
  1880.        {
  1881.            MyBob->X = 650;
  1882.            MyBob->Y = 410;
  1883.            UpdateBob();
  1884.            DeleteVSprite(MyBob);
  1885.            MyBob = MakeBob(650,410,9,1,2,turret,0x03,0x00);
  1886.            AddBob(MyBob->VSBob,Rp);
  1887.            ObjCode = ";";
  1888.            ObjValue = 27;
  1889.            roadpen = 0;
  1890.            return();
  1891.        }
  1892.    else if ((x>592) && (x<606) && (y>211) && (y<223))
  1893.        {
  1894.            MyBob->X = 650;
  1895.            MyBob->Y = 410;
  1896.            UpdateBob();
  1897.            DeleteVSprite(MyBob);
  1898.            MyBob = MakeBob(650,410,9,1,2,door,0x03,0x00);
  1899.            AddBob(MyBob->VSBob,Rp);
  1900.            ObjCode = "@";
  1901.            ObjValue = 44;
  1902.            roadpen = 0;
  1903.            return();
  1904.        }
  1905.    else if ((x>617) && (x<631) && (y>211) && (y<223))
  1906.        {
  1907.            MyBob->X = 650;
  1908.            MyBob->Y = 410;
  1909.            UpdateBob();
  1910.            DeleteVSprite(MyBob);
  1911.            MyBob = MakeBob(650,410,9,1,2,fuel,0x03,0x00);
  1912.            AddBob(MyBob->VSBob,Rp);
  1913.            ObjCode = "9";
  1914.            ObjValue = 25;
  1915.            roadpen = 0;
  1916.            return();
  1917.        }
  1918.    else if ((x>592) && (x<606) && (y>229) && (y<241))
  1919.        {
  1920.            MyBob->X = 650;
  1921.            MyBob->Y = 410;
  1922.            UpdateBob();
  1923.            DeleteVSprite(MyBob);
  1924.            MyBob = MakeBob(650,410,9,1,2,helipad,0x03,0x00);
  1925.            AddBob(MyBob->VSBob,Rp);
  1926.            ObjCode = ".";
  1927.            ObjValue = 14;
  1928.            roadpen = 1;
  1929.            return();
  1930.        }
  1931.    else if ((x>617) && (x<631) && (y>229) && (y<241))
  1932.        {
  1933.            MyBob->X = 650;
  1934.            MyBob->Y = 410;
  1935.            UpdateBob();
  1936.            DeleteVSprite(MyBob);
  1937.            MyBob = MakeBob(650,410,9,1,2,barracks,0x03,0x00);
  1938.            AddBob(MyBob->VSBob,Rp);
  1939.            ObjCode = "6";
  1940.            ObjValue = 22;
  1941.            roadpen = 0;
  1942.            return();
  1943.        }
  1944.    else if ((x>592) && (x<606) && (y>247) && (y<259))
  1945.        {
  1946.            MyBob->X = 650;
  1947.            MyBob->Y = 410;
  1948.            UpdateBob();
  1949.            DeleteVSprite(MyBob);
  1950.            MyBob = MakeBob(650,410,9,1,2,home,0x03,0x00);
  1951.            AddBob(MyBob->VSBob,Rp);
  1952.            ObjCode = "4";
  1953.            ObjValue = 20;
  1954.            roadpen = 0;
  1955.            return();
  1956.        }
  1957.    else if ((x>617) && (x<631) && (y>247) && (y<259))
  1958.        {
  1959.            MyBob->X = 650;
  1960.            MyBob->Y = 410;
  1961.            UpdateBob();
  1962.            DeleteVSprite(MyBob);
  1963.            MyBob = MakeBob(650,410,9,1,2,medic,0x03,0x00);
  1964.            AddBob(MyBob->VSBob,Rp);
  1965.            ObjCode = "8";
  1966.            ObjValue = 24;
  1967.            roadpen = 0;
  1968.            return();
  1969.        }
  1970.    else if ((x>592) && (x<606) && (y>265) && (y<277))
  1971.        {
  1972.            MyBob->X = 650;
  1973.            MyBob->Y = 410;
  1974.            UpdateBob();
  1975.            DeleteVSprite(MyBob);
  1976.            MyBob = MakeBob(650,410,9,1,2,flg,0x03,0x00);
  1977.            AddBob(MyBob->VSBob,Rp);
  1978.            ObjCode = "5";
  1979.            ObjValue = 89;
  1980.            roadpen = 0;
  1981.            return();
  1982.        }
  1983.    else if ((x>617) && (x<631) && (y>265) && (y<277))
  1984.        {
  1985.            MyBob->X = 650;
  1986.            MyBob->Y = 410;
  1987.            UpdateBob();
  1988.            DeleteVSprite(MyBob);
  1989.            MyBob = MakeBob(650,410,9,1,2,utility,0x03,0x00);
  1990.            AddBob(MyBob->VSBob,Rp);
  1991.            ObjCode = "2";
  1992.            ObjValue = 18;
  1993.            roadpen = 0;
  1994.            return();
  1995.        }
  1996.    else if ((x>592) && (x<606) && (y>283) && (y<295))
  1997.        {
  1998.            MyBob->X = 650;
  1999.            MyBob->Y = 410;
  2000.            UpdateBob();
  2001.            DeleteVSprite(MyBob);
  2002.            MyBob = MakeBob(650,410,9,1,2,officer,0x03,0x00);
  2003.            AddBob(MyBob->VSBob,Rp);
  2004.            ObjCode = "1";
  2005.            ObjValue = 17;
  2006.            roadpen = 0;
  2007.            return();
  2008.        }
  2009.    else if ((x>617) && (x<631) && (y>283) && (y<295))
  2010.        {
  2011.            MyBob->X = 650;
  2012.            MyBob->Y = 410;
  2013.            UpdateBob();
  2014.            DeleteVSprite(MyBob);
  2015.            MyBob = MakeBob(650,410,9,1,2,prisoner,0x03,0x00);
  2016.            AddBob(MyBob->VSBob,Rp);
  2017.            ObjCode = "3";
  2018.            ObjValue = 19;
  2019.            roadpen = 0;
  2020.            return();
  2021.        }
  2022.    else if ((x>592) && (x<606) && (y>301) && (y<313))
  2023.        {
  2024.            MyBob->X = 650;
  2025.            MyBob->Y = 410;
  2026.            UpdateBob();
  2027.            DeleteVSprite(MyBob);
  2028.            MyBob = MakeBob(650,410,9,1,2,smtree,0x03,0x00);
  2029.            AddBob(MyBob->VSBob,Rp);
  2030.            ObjCode = "#";
  2031.            ObjValue = 3;
  2032.            roadpen = 0;
  2033.            return();
  2034.        }
  2035.    else if ((x>617) && (x<631) && (y>301) && (y<313))
  2036.        {
  2037.            MyBob->X = 650;
  2038.            MyBob->Y = 410;
  2039.            UpdateBob();
  2040.            DeleteVSprite(MyBob);
  2041.            MyBob = MakeBob(650,410,9,1,2,medtree,0x03,0x00);
  2042.            AddBob(MyBob->VSBob,Rp);
  2043.            ObjCode = "$";
  2044.            ObjValue = 4;
  2045.            roadpen = 0;
  2046.            return();
  2047.        }
  2048.    else if ((x>592) && (x<606) && (y>319) && (y<331))
  2049.        {
  2050.            MyBob->X = 650;
  2051.            MyBob->Y = 410;
  2052.            UpdateBob();
  2053.            DeleteVSprite(MyBob);
  2054.            MyBob = MakeBob(650,410,9,1,2,bigtree,0x03,0x00);
  2055.            AddBob(MyBob->VSBob,Rp);
  2056.            ObjCode = "%";
  2057.            ObjValue = 2;
  2058.            roadpen = 0;
  2059.            return();
  2060.        }
  2061.    else if ((x>617) && (x<631) && (y>319) && (y<331))
  2062.        {
  2063.            MyBob->X = 650;
  2064.            MyBob->Y = 410;
  2065.            UpdateBob();
  2066.            DeleteVSprite(MyBob);
  2067.            MyBob = MakeBob(650,410,9,1,2,blank,0x03,0x00);
  2068.            AddBob(MyBob->VSBob,Rp);
  2069.            ObjCode = " ";
  2070.            rndnum = ran()*2;
  2071.            ObjValue = rndnum;
  2072.            return();
  2073.        }
  2074.    else if ((x>592) && (x<623) && (y>340) && (y<363))
  2075.             DrawLine();
  2076. }
  2077.  
  2078. DrawLine()  /* This routine draws a line from point A to point B */
  2079.             /* If points are not lined up, a filled rectangle will result */
  2080. {
  2081.            int i, hor, ver, bx = 0, by = 0, ex = 0, ey = 0;
  2082.            SetFont(Rp,FontPtr2);
  2083.            for (i=1;i<9;i++)
  2084.               {
  2085.                  PrintAt(590,380,"PT A?");
  2086.                  Delay(3);
  2087.                  PrintAt(590,380,"     ");
  2088.                  Delay(3);
  2089.               }
  2090.      FOREVER
  2091.         {
  2092.              sprintf(OutText,"%3d,%2d",x/9,y/9-1+topoffset);
  2093.              PrintAt(582,394,OutText);
  2094.              MouseMoved = FALSE;
  2095.          while(message = GetMsg(Wdw->UserPort))
  2096.              {
  2097.              switch (message->Class)
  2098.                 {
  2099.                    case MOUSEMOVE   : MouseMoved = TRUE;
  2100.                                       x = message->MouseX;
  2101.                                       y = message->MouseY;
  2102.                                       ReplyMsg(message);
  2103.                                       break;
  2104.  
  2105.                    case MOUSEBUTTONS: if ((message->Code) == SELECTDOWN)
  2106.                                         {
  2107.                                            bx = x/9;
  2108.                                            by = y/9-1;
  2109.                                            goto part2;
  2110.                                         } 
  2111.                                       ReplyMsg(message);
  2112.                                       break;
  2113.                 }
  2114.              } /*End While */
  2115.              if(MouseMoved == TRUE)
  2116.                 {
  2117.                    MyBob->X = x-9;
  2118.                    MyBob->Y = y-10;
  2119.                    SortGList(Rp);
  2120.                    DrawGList(Rp,Vp);
  2121.                    RethinkDisplay();
  2122.                 }
  2123.          } /* End FOREVER */
  2124.  
  2125. part2:     for (i=1;i<9;i++)
  2126.               {
  2127.                  PrintAt(590,380,"PT B?");
  2128.                  Delay(3);
  2129.                  PrintAt(590,380,"     ");
  2130.                  Delay(3);
  2131.               }
  2132.      FOREVER
  2133.         {
  2134.              sprintf(OutText,"%3d,%2d",x/9,y/9-1+topoffset);
  2135.              PrintAt(582,394,OutText);
  2136.              MouseMoved = FALSE;
  2137.          while(message = GetMsg(Wdw->UserPort))
  2138.              {
  2139.              switch (message->Class)
  2140.                 {
  2141.                    case MOUSEMOVE   : MouseMoved = TRUE;
  2142.                                       x = message->MouseX;
  2143.                                       y = message->MouseY;
  2144.                                       ReplyMsg(message);
  2145.                                       break;
  2146.  
  2147.                    case MOUSEBUTTONS: if ((message->Code) == SELECTDOWN)
  2148.                                         {
  2149.                                            ex = x/9;
  2150.                                            ey = y/9-1;
  2151.                                            goto draw;
  2152.                                         } 
  2153.                                       ReplyMsg(message);
  2154.                                       break;
  2155.                 }
  2156.              } /*End While */
  2157.              if(MouseMoved == TRUE)
  2158.                 {
  2159.                    MyBob->X = x-9;
  2160.                    MyBob->Y = y-10;
  2161.                    SortGList(Rp);
  2162.                    DrawGList(Rp,Vp);
  2163.                    RethinkDisplay();
  2164.                 }
  2165.          } /* End FOREVER */
  2166.  
  2167. draw:    SetFont(Rp,FontPtr1);
  2168.          if (pen==3)
  2169.              SetAPen(Rp,3);
  2170.          if (pen==2)
  2171.              SetAPen(Rp,2);
  2172.          if (roadpen==1)
  2173.              SetAPen(Rp,1);
  2174.          if ((ObjValue==2) || (ObjValue==3) || (ObjValue==4))
  2175.              SetAPen(Rp,2);
  2176.          MyBob->X = 650;
  2177.          MyBob->Y = 410;
  2178.          UpdateBob();
  2179.          if (bx<1) bx=1;
  2180.          if (bx>64) bx=64;
  2181.          if (by<1) by=1;
  2182.          if (by>64) by=64;
  2183.          if (ex<1) ex=1;
  2184.          if (ex>64) ex=64;
  2185.          if (ey<1) ey=1;
  2186.          if (ey>64) ey=64;
  2187.  
  2188.          if ((ex>=bx)&&(ey>=by))
  2189.            {
  2190.               for (hor=bx;hor<=ex;hor++)
  2191.                  {
  2192.                     for (ver=by;ver<=ey;ver++)
  2193.                        {
  2194.                           map[hor][ver+topoffset] = ObjValue;
  2195.                           PrintAt(hor*9-6,(ver+1)*9+2,ObjCode);
  2196.                        }
  2197.                  }
  2198.            }
  2199.          else if ((ex<=bx)&&(ey<=by))
  2200.            {
  2201.               for (hor=ex;hor<=bx;hor++)
  2202.                  {
  2203.                     for (ver=ey;ver<=by;ver++)
  2204.                        {
  2205.                           map[hor][ver+topoffset] = ObjValue;
  2206.                           PrintAt(hor*9-6,(ver+1)*9+2,ObjCode);
  2207.                        }
  2208.                  }
  2209.            }
  2210.          else if ((ex<=bx)&&(ey>=by))
  2211.            {
  2212.               for (hor=ex;hor<=bx;hor++)
  2213.                  {
  2214.                     for (ver=by;ver<=ey;ver++)
  2215.                        {
  2216.                           map[hor][ver+topoffset] = ObjValue;
  2217.                           PrintAt(hor*9-6,(ver+1)*9+2,ObjCode);
  2218.                        }
  2219.                  }
  2220.            }
  2221.          else if ((ex>=bx)&&(ey<=by))
  2222.            {
  2223.               for (hor=bx;hor<=ex;hor++)
  2224.                  {
  2225.                     for (ver=ey;ver<=by;ver++)
  2226.                        {
  2227.                           map[hor][ver+topoffset] = ObjValue;
  2228.                           PrintAt(hor*9-6,(ver+1)*9+2,ObjCode);
  2229.                        }
  2230.                  }
  2231.            }
  2232.     SetAPen(Rp,1);
  2233.     return();        
  2234. }
  2235.  
  2236. Initialize()
  2237. {
  2238.    LONG boxcnt;
  2239.    SetFont(Rp,FontPtr1);   /* FirePower Font */
  2240.    NewMenu( &fmenu, filemenu_names, file_items, file_names,
  2241.             NUM_FILE_ITEMS, item_widths, BLACK_FILL);
  2242.  
  2243.    SetMenuStrip(Wdw, &fmenu);
  2244.    LoadRGB4(Vp,&colors,4);
  2245.    SetAPen(Rp,1);   /* Drawing Color (BLACK) */
  2246.    SetBPen(Rp,0);   /* Background Color (GREY) */
  2247.    ClrScr();
  2248.    RectFill(Rp,580,10,581,399); /* Draw line dividing map and menu */
  2249.  
  2250.    RectFill(Rp,588,15,607,26);  /* Draw border around brown pick box */
  2251.    SetAPen(Rp,3);                  /* Set color to brown */
  2252.    RectFill(Rp,590,17,605,24);  /* Fill in brown box */
  2253.    SetAPen(Rp,2);                  /* Set color to green */
  2254.    RectFill(Rp,614,16,631,25);  /* Fill in green box */
  2255.    pen = 3;  /* set drawing pen to brown */
  2256.  
  2257.    for (boxcnt = 47;boxcnt < 330;boxcnt += 18)
  2258.       {
  2259.        SetAPen(Rp,1);                               /* Set color to black */
  2260.        RectFill(Rp,590,boxcnt,604,boxcnt+12);     /* Draw black boxes for menu picks */
  2261.        RectFill(Rp,615,boxcnt,629,boxcnt+12);
  2262.        SetAPen(Rp,0);                               /* Set color to background */
  2263.        RectFill(Rp,591,boxcnt+1,603,boxcnt+11);  /* Hollow out black boxes */
  2264.        RectFill(Rp,616,boxcnt+1,628,boxcnt+11);
  2265.       }
  2266.    SetAPen(Rp,1);
  2267.    PrintAt(593,58,">");
  2268.    PrintAt(618,58,"B");
  2269.    PrintAt(593,76,"A");
  2270.    PrintAt(618,76,"?");
  2271.    PrintAt(593,94,"D");
  2272.    PrintAt(618,94,"C");
  2273.    PrintAt(593,112,"/");
  2274.    PrintAt(618,112,"0");
  2275.    PrintAt(593,130,")");
  2276.    PrintAt(618,130,"'");
  2277.    PrintAt(593,148,"+");
  2278.    PrintAt(618,148,"-");
  2279.    PrintAt(593,166,"(");
  2280.    PrintAt(618,166,"*");
  2281.    PrintAt(593,184,"&");
  2282.    PrintAt(618,184,",");
  2283.    PrintAt(593,202,"<");
  2284.    PrintAt(618,202,";");
  2285.    PrintAt(593,220,"@");
  2286.    PrintAt(618,220,"9");
  2287.    PrintAt(593,238,".");
  2288.    PrintAt(618,238,"6");
  2289.    PrintAt(593,256,"4");
  2290.    PrintAt(618,256,"8");
  2291.    PrintAt(593,274,"5");
  2292.    PrintAt(618,274,"2");
  2293.    PrintAt(593,292,"1");
  2294.    PrintAt(618,292,"3");
  2295.    PrintAt(593,310,"#");
  2296.    PrintAt(618,310,"$");
  2297.    PrintAt(593,328,"%");
  2298.  
  2299.    RectFill(Rp,594,342,625,365); /* Draw box for 'line draw' */
  2300.    SetAPen(Rp,0);
  2301.    RectFill(Rp,595,343,624,364); /* Hollow out box */
  2302.    SetAPen(Rp,1);
  2303.    RectFill(Rp,600,347,600,360);
  2304.    RectFill(Rp,605,354,620,354);
  2305. }
  2306.  
  2307. NewMenu ( menu, item_names,  menu_items, menu_text, num_items, Mwidth, flag)
  2308.  
  2309. struct Menu      *menu;
  2310. char             *item_names[];
  2311. struct MenuItem  menu_items[];
  2312. struct IntuiText menu_text[];
  2313. int               num_items;
  2314. int               Mwidth;
  2315. long                flag;
  2316. {
  2317.     int i;
  2318.     int height = 0;
  2319.  
  2320.     for (i=0; i< num_items; i++) {
  2321.  
  2322.           menu_text[i].IText = item_names[i];
  2323.           menu_items[i].NextItem = &menu_items[i+1];
  2324.           menu_items[i].TopEdge = 10 * i;
  2325.           menu_items[i].LeftEdge = 0;
  2326.           menu_items[i].Height = 8;
  2327.           menu_items[i].ItemFill = (APTR)&menu_text[i];
  2328.           menu_items[i].Flags = flag;
  2329.           menu_items[i].Width = Mwidth;
  2330.           menu_items[i].MutualExclude = 0x0000;
  2331.           menu_items[i].Command = 0;
  2332.           menu_items[i].SubItem = NULL;
  2333.           menu_items[i].NextSelect = NULL;
  2334.           height += 10;
  2335.     }
  2336.     menu_items[num_items-1].NextItem = NULL;
  2337.     menu->Height = height;
  2338. }
  2339.  
  2340. domenu(item)
  2341. int item;
  2342. {
  2343.       switch (item) {
  2344.  
  2345.             case   NEW_ITEM: NewScr();
  2346.                              break;
  2347.  
  2348.             case  LOAD_ITEM: LoadMap();
  2349.                              break;
  2350.  
  2351.             case  SAVE_ITEM: SaveMap();
  2352.                              break;
  2353.  
  2354.             case  LOADLEFT_ITEM:  LoadLeft();
  2355.                                   break;
  2356.  
  2357.             case  LOADRIGHT_ITEM: LoadRight();
  2358.                                   break;
  2359.  
  2360.             case  SAVELEFT_ITEM : SaveLeft();
  2361.                                   break;
  2362.  
  2363.             case  SAVERIGHT_ITEM: SaveRight();
  2364.                                   break;
  2365.  
  2366.             case  QUIT_ITEM: End_program();
  2367.                              exit(0);
  2368.                              break;
  2369.                    }
  2370. }
  2371.  
  2372. NewScr()
  2373. {
  2374.    int treesx;
  2375.    int treesy;
  2376.    char ch;
  2377.    topoffset = 0;
  2378.    ClrScr();
  2379.    SetAPen(Rp,1);
  2380.    SetFont(Rp,FontPtr2);
  2381.    PrintAt(40,200,"Would you like random trees? (y/n) ");
  2382.    SetFont(Rp,FontPtr1);
  2383.    for (;;)
  2384.       {
  2385.         message = GetMsg(Wdw->UserPort);
  2386.         if ((message->Code) < 200)
  2387.            break;
  2388.       }
  2389.  
  2390.    if ((message->Code) == 21)
  2391.      {
  2392.         for (treesx=1;treesx<65;treesx++)
  2393.            {
  2394.               for (treesy=1;treesy<65;treesy++)
  2395.                  {
  2396.                     rndnum = ran()*5;
  2397.                     map[treesx][treesy] = rndnum;
  2398.                  }
  2399.            }
  2400.      }
  2401.    else
  2402.      {
  2403.         for (treesx=1;treesx<65;treesx++)
  2404.            {
  2405.               for (treesy=1;treesy<65;treesy++)
  2406.                  {
  2407.                     rndnum = ran()*2;
  2408.                     map[treesx][treesy] = rndnum;
  2409.                  }
  2410.            }
  2411.      }
  2412.    PrintScr();
  2413. }
  2414.    
  2415. PrintScr()     /* This routine prints the map on the screen */
  2416. {
  2417.    int row,col;
  2418.    char *TempCode;
  2419.    TempCode = ObjCode;
  2420.    MyBob->X = 650;
  2421.    MyBob->Y = 410;
  2422.    UpdateBob();
  2423.    ClrScr();
  2424.    topoffset = 0;
  2425.    for (row=0;row<64;row++)
  2426.       {
  2427.          for (col=1;col<44;col++)
  2428.             {
  2429.                 if (map[row+1][col]<2)
  2430.                       continue;
  2431.                 if (map[row+1][col]==3)
  2432.                   {
  2433.                       ObjCode = "#";
  2434.                       SetAPen(Rp,2);
  2435.                       goto next3;
  2436.                   }
  2437.                 if (map[row+1][col]==4)
  2438.                   {
  2439.                       ObjCode = "$";
  2440.                       SetAPen(Rp,2);
  2441.                       goto next3;
  2442.                   }
  2443.                 if (map[row+1][col]==2)
  2444.                   {
  2445.                       ObjCode = "%";
  2446.                       SetAPen(Rp,2);
  2447.                       goto next3;
  2448.                   }
  2449.                 if (map[row+1][col]==34)
  2450.                   {
  2451.                       ObjCode = "6";
  2452.                       SetAPen(Rp,2);
  2453.                       goto next3;
  2454.                   }
  2455.                 if (map[row+1][col]==22)
  2456.                   {
  2457.                       ObjCode = "6";
  2458.                       SetAPen(Rp,3);
  2459.                       goto next3;
  2460.                   }
  2461.                 if (map[row+1][col]==87)
  2462.                   {
  2463.                       ObjCode = "<";
  2464.                       SetAPen(Rp,2);
  2465.                       goto next3;
  2466.                   }
  2467.                 if (map[row+1][col]==85)
  2468.                   {
  2469.                       ObjCode = "<";
  2470.                       SetAPen(Rp,3);
  2471.                       goto next3;
  2472.                   }
  2473.                 if (map[row+1][col]==67)
  2474.                   {
  2475.                       ObjCode = "@";
  2476.                       SetAPen(Rp,2);
  2477.                       goto next3;
  2478.                   }
  2479.                 if (map[row+1][col]==44)
  2480.                   {
  2481.                       ObjCode = "@";
  2482.                       SetAPen(Rp,3);
  2483.                       goto next3;
  2484.                   }
  2485.                 if (map[row+1][col]==11)
  2486.                   {
  2487.                       ObjCode = "+";
  2488.                       SetAPen(Rp,1);
  2489.                       goto next3;
  2490.                   }
  2491.                 if (map[row+1][col]==71)
  2492.                   {
  2493.                       ObjCode = "D";
  2494.                       SetAPen(Rp,2);
  2495.                       goto next3;
  2496.                   }
  2497.                 if (map[row+1][col]==48)
  2498.                   {
  2499.                       ObjCode = "D";
  2500.                       SetAPen(Rp,3);
  2501.                       goto next3;
  2502.                   }
  2503.                 if (map[row+1][col]==92)
  2504.                   {
  2505.                       ObjCode = "5";
  2506.                       SetAPen(Rp,2);
  2507.                       goto next3;
  2508.                   }
  2509.                 if (map[row+1][col]==89)
  2510.                   {
  2511.                       ObjCode = "5";
  2512.                       SetAPen(Rp,3);
  2513.                       goto next3;
  2514.                   }
  2515.                 if (map[row+1][col]==37)
  2516.                   {
  2517.                       ObjCode = "9";
  2518.                       SetAPen(Rp,2);
  2519.                       goto next3;
  2520.                   }
  2521.                 if (map[row+1][col]==25)
  2522.                   {
  2523.                       ObjCode = "9";
  2524.                       SetAPen(Rp,3);
  2525.                       goto next3;
  2526.                   }
  2527.                 if (map[row+1][col]==14)
  2528.                   {
  2529.                       ObjCode = ".";
  2530.                       SetAPen(Rp,1);
  2531.                       goto next3;
  2532.                   }
  2533.                 if (map[row+1][col]==32)
  2534.                   {
  2535.                       ObjCode = "4";
  2536.                       SetAPen(Rp,2);
  2537.                       goto next3;
  2538.                   }
  2539.                 if (map[row+1][col]==20)
  2540.                   {
  2541.                       ObjCode = "4";
  2542.                       SetAPen(Rp,3);
  2543.                       goto next3;
  2544.                   }
  2545.                 if (map[row+1][col]==15)
  2546.                   {
  2547.                       ObjCode = "/";
  2548.                       SetAPen(Rp,1);
  2549.                       goto next3;
  2550.                   }
  2551.                 if (map[row+1][col]==65)
  2552.                   {
  2553.                       ObjCode = ">";
  2554.                       SetAPen(Rp,2);
  2555.                       goto next3;
  2556.                   }
  2557.                 if (map[row+1][col]==42)
  2558.                   {
  2559.                       ObjCode = ">";
  2560.                       SetAPen(Rp,3);
  2561.                       goto next3;
  2562.                   }
  2563.                 if (map[row+1][col]==36)
  2564.                   {
  2565.                       ObjCode = "8";
  2566.                       SetAPen(Rp,2);
  2567.                       goto next3;
  2568.                   }
  2569.                 if (map[row+1][col]==24)
  2570.                   {
  2571.                       ObjCode = "8";
  2572.                       SetAPen(Rp,3);
  2573.                       goto next3;
  2574.                   }
  2575.                 if (map[row+1][col]==29)
  2576.                   {
  2577.                       ObjCode = "1";
  2578.                       SetAPen(Rp,2);
  2579.                       goto next3;
  2580.                   }
  2581.                 if (map[row+1][col]==17)
  2582.                   {
  2583.                       ObjCode = "1";
  2584.                       SetAPen(Rp,3);
  2585.                       goto next3;
  2586.                   }
  2587.                 if (map[row+1][col]==31)
  2588.                   {
  2589.                       ObjCode = "3";
  2590.                       SetAPen(Rp,2);
  2591.                       goto next3;
  2592.                   }
  2593.                 if (map[row+1][col]==19)
  2594.                   {
  2595.                       ObjCode = "3";
  2596.                       SetAPen(Rp,3);
  2597.                       goto next3;
  2598.                   }
  2599.                 if (map[row+1][col]==10)
  2600.                   {
  2601.                       ObjCode = "*";
  2602.                       SetAPen(Rp,1);
  2603.                       goto next3;
  2604.                   }
  2605.                 if (map[row+1][col]==7)
  2606.                   {
  2607.                       ObjCode = "'";
  2608.                       SetAPen(Rp,1);
  2609.                       goto next3;
  2610.                   }
  2611.                 if (map[row+1][col]==66)
  2612.                   {
  2613.                       ObjCode = "?";
  2614.                       SetAPen(Rp,2);
  2615.                       goto next3;
  2616.                   }
  2617.                 if (map[row+1][col]==43)
  2618.                   {
  2619.                       ObjCode = "?";
  2620.                       SetAPen(Rp,3);
  2621.                       goto next3;
  2622.                   }
  2623.                 if (map[row+1][col]==6)
  2624.                   {
  2625.                       ObjCode = "&";
  2626.                       SetAPen(Rp,1);
  2627.                       goto next3;
  2628.                   }
  2629.                 if (map[row+1][col]==12)
  2630.                   {
  2631.                       ObjCode = ",";
  2632.                       SetAPen(Rp,1);
  2633.                       goto next3;
  2634.                   }
  2635.                 if (map[row+1][col]==13)
  2636.                   {
  2637.                       ObjCode = "-";
  2638.                       SetAPen(Rp,1);
  2639.                       goto next3;
  2640.                   }
  2641.                 if (map[row+1][col]==73)
  2642.                   {
  2643.                       ObjCode = "C";
  2644.                       SetAPen(Rp,2);
  2645.                       goto next3;
  2646.                   }
  2647.                 if (map[row+1][col]==50)
  2648.                   {
  2649.                       ObjCode = "C";
  2650.                       SetAPen(Rp,3);
  2651.                       goto next3;
  2652.                   }
  2653.                 if (map[row+1][col]==39)
  2654.                   {
  2655.                       ObjCode = ";";
  2656.                       SetAPen(Rp,2);
  2657.                       goto next3;
  2658.                   }
  2659.                 if (map[row+1][col]==27)
  2660.                   {
  2661.                       ObjCode = ";";
  2662.                       SetAPen(Rp,3);
  2663.                       goto next3;
  2664.                   }
  2665.                 if (map[row+1][col]==8)
  2666.                   {
  2667.                       ObjCode = "(";
  2668.                       SetAPen(Rp,1);
  2669.                       goto next3;
  2670.                   }
  2671.                 if (map[row+1][col]==5)
  2672.                   {
  2673.                       ObjCode = ")";
  2674.                       SetAPen(Rp,1);
  2675.                       goto next3;
  2676.                   }
  2677.                 if (map[row+1][col]==64)
  2678.                   {
  2679.                       ObjCode = "A";
  2680.                       SetAPen(Rp,2);
  2681.                       goto next3;
  2682.                   }
  2683.                 if (map[row+1][col]==41)
  2684.                   {
  2685.                       ObjCode = "A";
  2686.                       SetAPen(Rp,3);
  2687.                       goto next3;
  2688.                   }
  2689.                 if (map[row+1][col]==30)
  2690.                   {
  2691.                       ObjCode = "2";
  2692.                       SetAPen(Rp,2);
  2693.                       goto next3;
  2694.                   }
  2695.                 if (map[row+1][col]==18)
  2696.                   {
  2697.                       ObjCode = "2";
  2698.                       SetAPen(Rp,3);
  2699.                       goto next3;
  2700.                   }
  2701.                 if (map[row+1][col]==16)
  2702.                   {
  2703.                       ObjCode = "0";
  2704.                       SetAPen(Rp,1);
  2705.                       goto next3;
  2706.                   }
  2707.                 if (map[row+1][col]==70)
  2708.                   {
  2709.                       ObjCode = "B";
  2710.                       SetAPen(Rp,2);
  2711.                       goto next3;
  2712.                   }
  2713.                 if (map[row+1][col]==47)
  2714.                   {
  2715.                       ObjCode = "B";
  2716.                       SetAPen(Rp,3);
  2717.                       goto next3;
  2718.                   }
  2719.                       continue;
  2720.  
  2721.                next3: PrintAt(row*9+3,col*9+11,ObjCode);
  2722.             }
  2723.       }
  2724.      ObjCode = TempCode;
  2725.      SetAPen(Rp,1);
  2726. }
  2727.  
  2728. LoadMap()       /* This routine will load a full (4096 bytes) map. */
  2729. {
  2730.    FILE *in;
  2731.    char buf[27];
  2732.    int i = 0;
  2733.    int j, row, col;
  2734.    ClrScr();
  2735.    SetAPen(Rp,1);
  2736.    SetFont(Rp,FontPtr2);
  2737.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|VANILLAKEY|MOUSEBUTTONS|MENUPICK);
  2738.    PrintAt(50,100,"Enter name of map to load: ");
  2739.    for (;;)
  2740.       {
  2741.         message = GetMsg(Wdw->UserPort);
  2742.         if ((message->Code) == 13)
  2743.              break;
  2744.         if (((message->Code) > 7) && ((message->Code) < 123))
  2745.           {
  2746.              buf[i] = message->Code;
  2747.                   if ((buf[i] == 8) && (i>0))
  2748.                     {
  2749.                        i-=1;
  2750.                        PrintAt(i*8+266,100," ");
  2751.                     }
  2752.                   else
  2753.                     {
  2754.                        if (((buf[i] == 8) && (i==0)) || (i>25))
  2755.                             goto skip;
  2756.                        sprintf(OutText,"%c",buf[i]);
  2757.                        PrintAt(i*8+266,100,OutText);
  2758.                        i++;
  2759.                        skip: ;
  2760.                     }
  2761.           }
  2762.       }
  2763.    buf[i] = 0;
  2764.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|RAWKEY|MOUSEBUTTONS|MENUPICK);
  2765.    if ((in = fopen(&buf[0],"r")) != NULL)
  2766.      {
  2767.         SetFont(Rp,FontPtr1);
  2768.         for (row=1;row<65;row++)
  2769.            {
  2770.               for (col=1;col<65;col++)
  2771.                    map[row][col] = getc(in);
  2772.            }
  2773.         fclose(in);
  2774.         PrintScr();
  2775.      }
  2776.    else
  2777.         PrintAt(200,200,"Error, can't load file.");
  2778.    SetFont(Rp,FontPtr1);
  2779. }
  2780.  
  2781. SaveMap()     /* This routine saved a full (4096 bytes) map. */
  2782. {
  2783.    FILE *out;
  2784.    char buf[27];
  2785.    int i = 0;
  2786.    int j, row, col;
  2787.    ClrScr();
  2788.    SetAPen(Rp,1);
  2789.    SetFont(Rp,FontPtr2);
  2790.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|VANILLAKEY|MOUSEBUTTONS|MENUPICK);
  2791.    PrintAt(50,100,"Enter name of map to save: ");
  2792.    for (;;)
  2793.       {
  2794.         message = GetMsg(Wdw->UserPort);
  2795.         if ((message->Code) == 13)
  2796.              break;
  2797.         if (((message->Code) > 7) && ((message->Code) < 123))
  2798.           {
  2799.              buf[i] = message->Code;
  2800.                   if ((buf[i] == 8) && (i>0))
  2801.                     {
  2802.                        i-=1;
  2803.                        PrintAt(i*8+266,100," ");
  2804.                     }
  2805.                   else
  2806.                     {
  2807.                        if (((buf[i] == 8) && (i==0)) || (i>25))
  2808.                             goto skip;
  2809.                        sprintf(OutText,"%c",buf[i]);
  2810.                        PrintAt(i*8+266,100,OutText);
  2811.                        i++;
  2812.                        skip: ;
  2813.                     }
  2814.           }
  2815.       }
  2816.    buf[i] = 0;
  2817.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|RAWKEY|MOUSEBUTTONS|MENUPICK);
  2818.    if ((out = fopen(&buf[0],"w")) != NULL)
  2819.      {
  2820.         SetFont(Rp,FontPtr1);
  2821.         for (row=1;row<65;row++)
  2822.            {
  2823.               for (col=1;col<65;col++)
  2824.                    putc(map[row][col],out);
  2825.            }
  2826.         fclose(out);
  2827.         PrintScr();
  2828.      }
  2829.    else
  2830.         PrintAt(200,200,"Error, can't save file.");
  2831.    SetFont(Rp,FontPtr1);
  2832. }
  2833.  
  2834. LoadLeft()  /* This routine loads the left half of a map (2048 bytes) */
  2835. {
  2836.    FILE *in;
  2837.    char buf[27];
  2838.    int i = 0;
  2839.    int j, row, col;
  2840.    ClrScr();
  2841.    SetAPen(Rp,1);
  2842.    SetFont(Rp,FontPtr2);
  2843.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|VANILLAKEY|MOUSEBUTTONS|MENUPICK);
  2844.    PrintAt(50,100,"Enter name of left map to load: ");
  2845.    for (;;)
  2846.       {
  2847.         message = GetMsg(Wdw->UserPort);
  2848.         if ((message->Code) == 13)
  2849.              break;
  2850.         if (((message->Code) > 7) && ((message->Code) < 123))
  2851.           {
  2852.              buf[i] = message->Code;
  2853.                   if ((buf[i] == 8) && (i>0))
  2854.                     {
  2855.                        i-=1;
  2856.                        PrintAt(i*8+306,100," ");
  2857.                     }
  2858.                   else
  2859.                     {
  2860.                        if (((buf[i] == 8) && (i==0)) || (i>25))
  2861.                             goto skip;
  2862.                        sprintf(OutText,"%c",buf[i]);
  2863.                        PrintAt(i*8+306,100,OutText);
  2864.                        i++;
  2865.                        skip: ;
  2866.                     }
  2867.           }
  2868.       }
  2869.    buf[i] = 0;
  2870.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|RAWKEY|MOUSEBUTTONS|MENUPICK);
  2871.    if ((in = fopen(&buf[0],"r")) != NULL)
  2872.      {
  2873.         SetFont(Rp,FontPtr1);
  2874.         for (row=1;row<33;row++)
  2875.            {
  2876.               for (col=1;col<65;col++)
  2877.                    map[row][col] = getc(in);
  2878.            }
  2879.         fclose(in);
  2880.         PrintScr();
  2881.      }
  2882.    else
  2883.         PrintAt(200,200,"Error, can't load file.");
  2884.    SetFont(Rp,FontPtr1);
  2885. }
  2886.  
  2887. LoadRight()  /* This routine loads the right half of a map (2048 bytes)  */
  2888. {
  2889.    FILE *in;
  2890.    char buf[27];
  2891.    int i = 0;
  2892.    int j, row, col;
  2893.    ClrScr();
  2894.    SetAPen(Rp,1);
  2895.    SetFont(Rp,FontPtr2);
  2896.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|VANILLAKEY|MOUSEBUTTONS|MENUPICK);
  2897.    PrintAt(50,100,"Enter name of right map to load: ");
  2898.    for (;;)
  2899.       {
  2900.         message = GetMsg(Wdw->UserPort);
  2901.         if ((message->Code) == 13)
  2902.              break;
  2903.         if (((message->Code) > 7) && ((message->Code) < 123))
  2904.           {
  2905.              buf[i] = message->Code;
  2906.                   if ((buf[i] == 8) && (i>0))
  2907.                     {
  2908.                        i-=1;
  2909.                        PrintAt(i*8+314,100," ");
  2910.                     }
  2911.                   else
  2912.                     {
  2913.                        if (((buf[i] == 8) && (i==0)) || (i>25))
  2914.                             goto skip;
  2915.                        sprintf(OutText,"%c",buf[i]);
  2916.                        PrintAt(i*8+314,100,OutText);
  2917.                        i++;
  2918.                        skip: ;
  2919.                     }
  2920.           }
  2921.       }
  2922.    buf[i] = 0;
  2923.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|RAWKEY|MOUSEBUTTONS|MENUPICK);
  2924.    if ((in = fopen(&buf[0],"r")) != NULL)
  2925.      {
  2926.         SetFont(Rp,FontPtr1);
  2927.         for (row=33;row<65;row++)
  2928.            {
  2929.               for (col=1;col<65;col++)
  2930.                    map[row][col] = getc(in);
  2931.            }
  2932.         fclose(in);
  2933.         PrintScr();
  2934.      }
  2935.    else
  2936.         PrintAt(200,200,"Error, can't load file.");
  2937.    SetFont(Rp,FontPtr1);
  2938. }
  2939.  
  2940. SaveLeft()   /* This routine saves the left half of a map (2048 bytes) */
  2941. {
  2942.    FILE *out;
  2943.    char buf[27];
  2944.    int i = 0;
  2945.    int j, row, col;
  2946.    ClrScr();
  2947.    SetAPen(Rp,1);
  2948.    SetFont(Rp,FontPtr2);
  2949.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|VANILLAKEY|MOUSEBUTTONS|MENUPICK);
  2950.    PrintAt(50,100,"Enter name of left map to save: ");
  2951.    for (;;)
  2952.       {
  2953.         message = GetMsg(Wdw->UserPort);
  2954.         if ((message->Code) == 13)
  2955.              break;
  2956.         if (((message->Code) > 7) && ((message->Code) < 123))
  2957.           {
  2958.              buf[i] = message->Code;
  2959.                   if ((buf[i] == 8) && (i>0))
  2960.                     {
  2961.                        i-=1;
  2962.                        PrintAt(i*8+306,100," ");
  2963.                     }
  2964.                   else
  2965.                     {
  2966.                        if (((buf[i] == 8) && (i==0)) || (i>25))
  2967.                             goto skip;
  2968.                        sprintf(OutText,"%c",buf[i]);
  2969.                        PrintAt(i*8+306,100,OutText);
  2970.                        i++;
  2971.                        skip: ;
  2972.                     }
  2973.           }
  2974.       }
  2975.    buf[i] = 0;
  2976.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|RAWKEY|MOUSEBUTTONS|MENUPICK);
  2977.    if ((out = fopen(&buf[0],"w")) != NULL)
  2978.      {
  2979.         SetFont(Rp,FontPtr1);
  2980.         for (row=1;row<33;row++)
  2981.            {
  2982.               for (col=1;col<65;col++)
  2983.                    putc(map[row][col],out);
  2984.            }
  2985.         fclose(out);
  2986.         PrintScr();
  2987.      }
  2988.    else
  2989.         PrintAt(200,200,"Error, can't save file.");
  2990.    SetFont(Rp,FontPtr1);
  2991. }
  2992.  
  2993. SaveRight()   /* This routine saves the right half of a map (2048 bytes) */
  2994. {
  2995.    FILE *out;
  2996.    char buf[27];
  2997.    int i = 0;
  2998.    int j, row, col;
  2999.    ClrScr();
  3000.    SetAPen(Rp,1);
  3001.    SetFont(Rp,FontPtr2);
  3002.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|VANILLAKEY|MOUSEBUTTONS|MENUPICK);
  3003.    PrintAt(50,100,"Enter name of right map to save: ");
  3004.    for (;;)
  3005.       {
  3006.         message = GetMsg(Wdw->UserPort);
  3007.         if ((message->Code) == 13)
  3008.              break;
  3009.         if (((message->Code) > 7) && ((message->Code) < 123))
  3010.           {
  3011.              buf[i] = message->Code;
  3012.                   if ((buf[i] == 8) && (i>0))
  3013.                     {
  3014.                        i-=1;
  3015.                        PrintAt(i*8+314,100," ");
  3016.                     }
  3017.                   else
  3018.                     {
  3019.                        if (((buf[i] == 8) && (i==0)) || (i>25))
  3020.                             goto skip;
  3021.                        sprintf(OutText,"%c",buf[i]);
  3022.                        PrintAt(i*8+314,100,OutText);
  3023.                        i++;
  3024.                        skip: ;
  3025.                     }
  3026.           }
  3027.       }
  3028.    buf[i] = 0;
  3029.    ModifyIDCMP(Wdw,CLOSEWINDOW|MOUSEMOVE|RAWKEY|MOUSEBUTTONS|MENUPICK);
  3030.    if ((out = fopen(&buf[0],"w")) != NULL)
  3031.      {
  3032.         SetFont(Rp,FontPtr1);
  3033.         for (row=33;row<65;row++)
  3034.            {
  3035.               for (col=1;col<65;col++)
  3036.                    putc(map[row][col],out);
  3037.            }
  3038.         fclose(out);
  3039.         PrintScr();
  3040.      }
  3041.    else
  3042.         PrintAt(200,200,"Error, can't save file.");
  3043.    SetFont(Rp,FontPtr1);
  3044. }
  3045.  
  3046. End_program()
  3047. {
  3048.    DeleteVSprite(MyBob);
  3049.  
  3050.        SortGList(Rp);
  3051.        DrawGList(Rp,Vp);
  3052.        RethinkDisplay();
  3053.  
  3054.    DeleteGelsInfo(Rp->GelsInfo);
  3055.    ClearMenuStrip(Wdw);
  3056.    CloseFont(FontPtr1);
  3057.    CloseFont(FontPtr2);
  3058.    CloseWindow(Wdw);
  3059.    CloseScreen(CustScr);
  3060.    CloseLibrary(DiskfontBase);
  3061.    CloseLibrary(GfxBase);
  3062.    CloseLibrary(IntuitionBase);
  3063. }
  3064.  
  3065.